16.13: async/await Part 1 – Topics of JavaScript/ES8




This video covers the new ES8 “async” and “await” keywords for writing asynchronous functions in JavaScript.

🎥 Next Video: https://youtu.be/chavThlNz3s

🔗 async on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function

🚂 Website: http://thecodingtrain.com/
💖 Patreon: https://patreon.com/codingtrain
🛒 Store: https://www.designbyhumans.com/shop/codingtrain/
📚 Book recommendations: https://www.amazon.com/shop/thecodingtrain

💻 https://github.com/CodingTrain/website

🎥 For more videos on ES6/JavaScript: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6YgpA3Oht-7B4NBQwFVe3pr
🎥 For more Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH

🔗 https://p5js.org/
🔗 https://processing.org

Original source


33 responses to “16.13: async/await Part 1 – Topics of JavaScript/ES8”

  1. @TheCodingTrain Daniel, beware that you properly return the expected Promise! At 4:50, your async function returns NOTHING, but the code executes anyway because the function does return a Promise internally. The issue you'd have is that the delay function gets's called, but if you expect to pass down a return value from the delay function, you would've lose that value, here. Unless the behavior is documented, you should return a value inside a promise chain.

    It is also important to note that promises are also recursive (DFS)! And you can still chain a promise AFTER a catch handler.

  2. I find it ironic that the modifier is "async" when what it effectively does is causes promises to operate synchronously… i.e. blocking. Or maybe I'm failing to understand. Keep up the great work!

Leave a Reply