MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/btxz72/what_are_some_javascript_things_beginners_dont/epbgfxb/?context=9999
r/javascript • u/[deleted] • May 28 '19
383 comments sorted by
View all comments
135
Promises. They are quite tricky to understand for a beginner, but very convenient as one masters.
10 u/amdc !CURSED! May 28 '19 knowing Promises is essential if you want to succeed, but once you're familiar with them you should move on to async/await 5 u/SharkLaunch May 29 '19 Async/await are just syntactic sugar around promises, and there are times when the former is more appropriate. 2 u/amdc !CURSED! May 29 '19 Out of interest, what are cases where promises are more appropriate (besides .race and .all which you totally can use in conjunction with await)? 1 u/SharkLaunch May 29 '19 If you're modifying a non-async method used in a lot of places, and you find you need to work with a promise inside it, it's much easier to just pass it callbacks than to make the method async and refactor every place where it's called.
10
knowing Promises is essential if you want to succeed, but once you're familiar with them you should move on to async/await
5 u/SharkLaunch May 29 '19 Async/await are just syntactic sugar around promises, and there are times when the former is more appropriate. 2 u/amdc !CURSED! May 29 '19 Out of interest, what are cases where promises are more appropriate (besides .race and .all which you totally can use in conjunction with await)? 1 u/SharkLaunch May 29 '19 If you're modifying a non-async method used in a lot of places, and you find you need to work with a promise inside it, it's much easier to just pass it callbacks than to make the method async and refactor every place where it's called.
5
Async/await are just syntactic sugar around promises, and there are times when the former is more appropriate.
2 u/amdc !CURSED! May 29 '19 Out of interest, what are cases where promises are more appropriate (besides .race and .all which you totally can use in conjunction with await)? 1 u/SharkLaunch May 29 '19 If you're modifying a non-async method used in a lot of places, and you find you need to work with a promise inside it, it's much easier to just pass it callbacks than to make the method async and refactor every place where it's called.
2
Out of interest, what are cases where promises are more appropriate (besides .race and .all which you totally can use in conjunction with await)?
1 u/SharkLaunch May 29 '19 If you're modifying a non-async method used in a lot of places, and you find you need to work with a promise inside it, it's much easier to just pass it callbacks than to make the method async and refactor every place where it's called.
1
If you're modifying a non-async method used in a lot of places, and you find you need to work with a promise inside it, it's much easier to just pass it callbacks than to make the method async and refactor every place where it's called.
135
u/theMightyPanda27 May 28 '19
Promises. They are quite tricky to understand for a beginner, but very convenient as one masters.