title
Are you bad, good, better or best with Async JS? JS Tutorial: Callbacks, Promises, Generators

description
The 4 levels of clean JS ASync programming: Javascript programming can get really ugly, really fast...but not if you know how to avoid "callback hell". Code available here: http://plnkr.co/edit/1ArvFxI0gWmajTpDaOSB?p=preview Also watch this video - ES6 Generators https://www.youtube.com/watch?v=QO07THdLWQo Level one: Programming with callbacks - you make it work, but it's ugly Level two: Programming with abstracted callbacks - cleaner for sure, but still messy and way too much repeated code Level three: Promises - much cleaner much more stable code, but still not as enjoyable as code should be Level four: Generators - life is good. This is a javascript promises tutorial / javascript generators tutorial. We're going to show the four levels and why each level is better than the one before it. Along the way, you should learn a decent bit about promises, and even some about generators. -~-~~-~~~-~~-~- Also watch: "Responsive Design Tutorial - Tips for making web sites look great on any device" https://www.youtube.com/watch?v=fgOO9YUFlGI -~-~~-~~~-~~-~-

detail
{'title': 'Are you bad, good, better or best with Async JS? JS Tutorial: Callbacks, Promises, Generators', 'heatmap': [{'end': 313.168, 'start': 303.642, 'weight': 1}], 'summary': 'This javascript tutorial covers async operations, refactoring callbacks to avoid callback hell, benefits and usage of promises, and introduces es6 generators for clean and asynchronous code production.', 'chapters': [{'end': 126.393, 'segs': [{'end': 49.662, 'src': 'embed', 'start': 24.287, 'weight': 1, 'content': [{'end': 31.25, 'text': "so let's get into async JavaScript, and the two-second description of that is for those of you who are newer to JavaScript,", 'start': 24.287, 'duration': 6.963}, {'end': 34.632, 'text': 'async is anytime you start something that completes.', 'start': 31.81, 'duration': 2.822}, {'end': 35.693, 'text': 'later on.', 'start': 34.632, 'duration': 1.061}, {'end': 40.596, 'text': 'JavaScript allows you to say hit an API and then not lock up your program.', 'start': 35.693, 'duration': 4.903}, {'end': 49.662, 'text': 'you can actually say start the API and move on with my code and when the API returns our response, say our tweets from the back end.', 'start': 40.596, 'duration': 9.066}], 'summary': 'Async javascript allows non-blocking api calls, enabling program to continue while waiting for response.', 'duration': 25.375, 'max_score': 24.287, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk24287.jpg'}, {'end': 92.143, 'src': 'embed', 'start': 65.637, 'weight': 0, 'content': [{'end': 71.178, 'text': "There's the good way, the better way, the best way, and the awesome way, which is the brand new way.", 'start': 65.637, 'duration': 5.541}, {'end': 73.199, 'text': "And let's get into it.", 'start': 71.978, 'duration': 1.221}, {'end': 77.88, 'text': 'This Plunker address will be in the description so you guys can go look at this code later.', 'start': 73.339, 'duration': 4.541}, {'end': 80.177, 'text': 'And so here we go.', 'start': 79.577, 'duration': 0.6}, {'end': 84.359, 'text': "Let's look at the first way of doing three async operations all in a row.", 'start': 80.257, 'duration': 4.102}, {'end': 85.92, 'text': "So I'm turning on the callbacks.", 'start': 84.419, 'duration': 1.501}, {'end': 88.901, 'text': 'These are all pieces of code are going to do the exact same thing.', 'start': 85.94, 'duration': 2.961}, {'end': 92.143, 'text': 'You can see again when I run it, it fires.', 'start': 89.461, 'duration': 2.682}], 'summary': 'Demonstrating three async operations in a row using callbacks.', 'duration': 26.506, 'max_score': 65.637, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk65637.jpg'}, {'end': 138.543, 'src': 'embed', 'start': 104.573, 'weight': 2, 'content': [{'end': 108.161, 'text': "If you're on the back end doing Node.js, the exact same principles apply.", 'start': 104.573, 'duration': 3.588}, {'end': 111.128, 'text': "And so let's get into it.", 'start': 108.181, 'duration': 2.947}, {'end': 114.664, 'text': 'This code right here is the callback way of doing it.', 'start': 112.142, 'duration': 2.522}, {'end': 115.465, 'text': "It's a mess.", 'start': 114.864, 'duration': 0.601}, {'end': 119.968, 'text': 'Just opening this makes you want to run for the ibuprofen because you feel the headache coming on.', 'start': 115.525, 'duration': 4.443}, {'end': 122.15, 'text': "And it's only three operations.", 'start': 120.349, 'duration': 1.801}, {'end': 124.752, 'text': "It's not this super complex thing going on.", 'start': 122.21, 'duration': 2.542}, {'end': 126.393, 'text': "We're just doing three things in a row.", 'start': 124.792, 'duration': 1.601}, {'end': 130.356, 'text': "We're firing a git to the profile.json.", 'start': 127.014, 'duration': 3.342}, {'end': 138.543, 'text': "Since we don't have a backend, we can't really hit a profile API, so I just have a static JSON file here that will give us the exact same response.", 'start': 130.757, 'duration': 7.786}], 'summary': 'Node.js back end code using callbacks for three operations, causing a headache, but not overly complex.', 'duration': 33.97, 'max_score': 104.573, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk104573.jpg'}], 'start': 1.502, 'title': 'Javascript async operations', 'summary': 'Covers different ways of handling async operations in javascript, emphasizing the challenges and the need for cleaner solutions.', 'chapters': [{'end': 126.393, 'start': 1.502, 'title': 'Handling javascript async operations', 'summary': 'Covers handling javascript async operations, explaining the concept of async in javascript, and presenting four different ways of handling async operations, emphasizing the challenges and the need for cleaner solutions.', 'duration': 124.891, 'highlights': ['JavaScript async operations allow starting something that completes later, such as hitting an API without locking up the program, enabling the processing of user events. JavaScript async operations enable hitting an API without locking up the program, allowing the processing of user events. This is essential for newer developers to understand.', 'The chapter presents four ways of handling async operations: the good way, the better way, the best way, and the brand new way, emphasizing the need for cleaner and more efficient solutions. The chapter introduces four methods for handling async operations, emphasizing the importance of finding cleaner and more efficient solutions. It outlines the good, better, best, and brand new ways, addressing the complexity of async operations.', 'The callback way of handling async operations is described as messy and headache-inducing, highlighting the need for cleaner and more manageable code. The callback way of handling async operations is depicted as messy and headache-inducing, even for a simple task, emphasizing the need for cleaner and more manageable code.']}], 'duration': 124.891, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk1502.jpg', 'highlights': ['The chapter introduces four methods for handling async operations, emphasizing the importance of finding cleaner and more efficient solutions. It outlines the good, better, best, and brand new ways, addressing the complexity of async operations.', 'JavaScript async operations allow starting something that completes later, such as hitting an API without locking up the program, enabling the processing of user events. This is essential for newer developers to understand.', 'The callback way of handling async operations is depicted as messy and headache-inducing, even for a simple task, emphasizing the need for cleaner and more manageable code.']}, {'end': 277.185, 'segs': [{'end': 194.45, 'src': 'embed', 'start': 170.512, 'weight': 0, 'content': [{'end': 176.937, 'text': "and then, on the success of that, we do our two things and we start up our third Ajax request, and I just can't go on.", 'start': 170.512, 'duration': 6.425}, {'end': 178.978, 'text': "It's bad for several reasons.", 'start': 177.777, 'duration': 1.201}, {'end': 180.579, 'text': "We've got the pyramid of doom.", 'start': 179.038, 'duration': 1.541}, {'end': 182.201, 'text': "Don't want to fork.", 'start': 180.599, 'duration': 1.602}, {'end': 183.041, 'text': "Don't know why I hit the button.", 'start': 182.281, 'duration': 0.76}, {'end': 186.364, 'text': 'We have the pyramid of doom going on right here as you can see.', 'start': 183.381, 'duration': 2.983}, {'end': 187.264, 'text': 'Pyramid of doom.', 'start': 186.464, 'duration': 0.8}, {'end': 189.506, 'text': "And it's also called callback hell.", 'start': 187.985, 'duration': 1.521}, {'end': 190.567, 'text': "It's just a mess.", 'start': 189.646, 'duration': 0.921}, {'end': 193.629, 'text': 'This is a very bad, bad shape in JavaScript.', 'start': 190.607, 'duration': 3.022}, {'end': 194.45, 'text': "You don't want to see that.", 'start': 193.649, 'duration': 0.801}], 'summary': 'The code has issues with the pyramid of doom and callback hell in javascript.', 'duration': 23.938, 'max_score': 170.512, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk170512.jpg'}, {'end': 235.503, 'src': 'embed', 'start': 209.956, 'weight': 1, 'content': [{'end': 216.518, 'text': "I'm going to kill this script, turn this one on, and the exact same thing just took place in the exact same way.", 'start': 209.956, 'duration': 6.562}, {'end': 217.999, 'text': "Let's look at the code for this.", 'start': 216.998, 'duration': 1.001}, {'end': 219.979, 'text': 'This code is called clean callbacks.', 'start': 218.039, 'duration': 1.94}, {'end': 225.88, 'text': 'We can move a next step forward By abstracting out the callbacks into their own function.', 'start': 220.019, 'duration': 5.861}, {'end': 231.782, 'text': "So here we fire up our first AJAX and then we're going to for success we're going to run the get tweets function.", 'start': 225.94, 'duration': 5.842}, {'end': 235.503, 'text': "And for error we're just running the handle error function.", 'start': 232.202, 'duration': 3.301}], 'summary': 'Code optimization: abstracting out callbacks improved efficiency in processing ajax requests.', 'duration': 25.547, 'max_score': 209.956, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk209956.jpg'}], 'start': 127.014, 'title': 'Refactoring javascript callbacks', 'summary': 'Discusses refactoring javascript callbacks to avoid the pyramid of doom and callback hell, demonstrating the clean callbacks code which simplifies the process and makes the code cleaner and more manageable.', 'chapters': [{'end': 277.185, 'start': 127.014, 'title': 'Refactoring javascript callbacks', 'summary': 'Discusses refactoring javascript callbacks to avoid the pyramid of doom and callback hell, demonstrating the clean callbacks code which simplifies the process and makes the code cleaner and more manageable.', 'duration': 150.171, 'highlights': ["The chapter discusses refactoring JavaScript callbacks to avoid the pyramid of doom and callback hell. The transcript highlights the issue of 'pyramid of doom' and 'callback hell' in JavaScript, emphasizing the need for refactoring callbacks to make the code cleaner and more manageable.", "The clean callbacks code simplifies the process and makes the code cleaner and more manageable. The transcript demonstrates the 'clean callbacks' code, which abstracts out the callbacks into their own function, making the code look cleaner and more organized, and simplifying the process of handling AJAX requests.", 'The need for abstracting out the callbacks into their own function is emphasized. The transcript emphasizes the importance of abstracting out the callbacks into their own function to improve code readability and organization, making it easier to handle multiple AJAX requests and errors.']}], 'duration': 150.171, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk127014.jpg', 'highlights': ['The chapter discusses refactoring JavaScript callbacks to avoid the pyramid of doom and callback hell.', 'The clean callbacks code simplifies the process and makes the code cleaner and more manageable.', 'The need for abstracting out the callbacks into their own function is emphasized.']}, {'end': 521.932, 'segs': [{'end': 329.637, 'src': 'heatmap', 'start': 303.642, 'weight': 0, 'content': [{'end': 307.926, 'text': "So let's look real quickly over to this file where I explain what promises are.", 'start': 303.642, 'duration': 4.284}, {'end': 313.168, 'text': 'So, a promise basically represents a future value.', 'start': 309.606, 'duration': 3.562}, {'end': 319.051, 'text': "It's a standard syntax for anything that has a delayed response.", 'start': 313.268, 'duration': 5.783}, {'end': 320.672, 'text': 'JavaScript uses promises.', 'start': 319.271, 'duration': 1.401}, {'end': 329.637, 'text': "pretty much every good library, every library that's built correctly, every framework that's built correctly, should use promises,", 'start': 320.672, 'duration': 8.965}], 'summary': 'Promises are a standard syntax for delayed responses; used in javascript and most good libraries/frameworks.', 'duration': 25.995, 'max_score': 303.642, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk303642.jpg'}, {'end': 360.677, 'src': 'embed', 'start': 338.402, 'weight': 3, 'content': [{'end': 346.607, 'text': 'And if you actually return the value from jQuery AJAX, say I do var get profile, then this is actually a promise or a deferred object.', 'start': 338.402, 'duration': 8.205}, {'end': 349.309, 'text': "Get profile doesn't stand for anything yet.", 'start': 347.087, 'duration': 2.222}, {'end': 350.89, 'text': "It's just a promise.", 'start': 349.429, 'duration': 1.461}, {'end': 355.473, 'text': 'It remembers what the state of this AJAX request is.', 'start': 351.43, 'duration': 4.043}, {'end': 360.677, 'text': 'So when the AJAX request moves on, at some point that AJAX request is going to go..', 'start': 355.913, 'duration': 4.764}], 'summary': 'Using jquery ajax returns a promise or deferred object, not yet defining get profile.', 'duration': 22.275, 'max_score': 338.402, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk338402.jpg'}, {'end': 414.132, 'src': 'embed', 'start': 385.923, 'weight': 4, 'content': [{'end': 388.866, 'text': 'So jQuery either resolves it or rejects it.', 'start': 385.923, 'duration': 2.943}, {'end': 397.082, 'text': "depending on what they do, it will get passed to your then function and Basically, if it's a promise, it has a then function to it.", 'start': 388.866, 'duration': 8.216}, {'end': 401.184, 'text': "That's pretty much what you need to remember is you can go get profile dot then.", 'start': 397.142, 'duration': 4.042}, {'end': 406.287, 'text': 'So dot then receives two things, a success function and an error function.', 'start': 401.664, 'duration': 4.623}, {'end': 414.132, 'text': 'If it was successful, if it was resolved, then it will run this with whatever it resolved it with as your argument right there.', 'start': 406.707, 'duration': 7.425}], 'summary': 'Jquery resolves or rejects promises, passed to then function with success and error functions.', 'duration': 28.209, 'max_score': 385.923, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk385923.jpg'}, {'end': 500.323, 'src': 'embed', 'start': 475.898, 'weight': 5, 'content': [{'end': 482.539, 'text': 'Because the then object, whatever you return from that, gets passed to the next then.', 'start': 475.898, 'duration': 6.641}, {'end': 485.06, 'text': 'You can do .then, .then, .then.', 'start': 482.639, 'duration': 2.421}, {'end': 490.541, 'text': 'And whatever this then function returns will get passed to the next then function.', 'start': 485.62, 'duration': 4.921}, {'end': 492.061, 'text': 'And so on and so on.', 'start': 490.961, 'duration': 1.1}, {'end': 500.323, 'text': "The cool thing is, is if you return another promise, it's going to wait for that promise to fulfill before firing the next then function.", 'start': 492.481, 'duration': 7.842}], 'summary': 'Chaining .then functions allows passing return values and promises sequentially.', 'duration': 24.425, 'max_score': 475.898, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk475898.jpg'}], 'start': 277.385, 'title': 'Promises in javascript and jquery', 'summary': 'Covers the benefits and usage of promises in javascript, emphasizing their role as a standard syntax for delayed responses. it also explains the use of jquery promises for handling asynchronous requests, focusing on concepts, functions for success and error handling, and chaining of promises for sequential execution.', 'chapters': [{'end': 337.861, 'start': 277.385, 'title': 'Understanding javascript promises', 'summary': 'Discusses the benefits of using promises in javascript, emphasizing that promises are a standard syntax for delayed responses and should be used in every well-built library or framework, with ajax being a common example.', 'duration': 60.476, 'highlights': ['Promises are a standard syntax for delayed responses in JavaScript, and should be used in well-built libraries or frameworks, with AJAX being a common example.', 'Developers should understand the concept of promises, as they represent a future value and lead to cleaner, better code.', 'Using promises in JavaScript results in cleaner and better-looking code, reducing the need for repeated and unnecessary code.']}, {'end': 521.932, 'start': 338.402, 'title': 'Using jquery promises for asynchronous requests', 'summary': 'Explains how to use jquery promises for handling asynchronous requests, highlighting the concept of promises, the use of then function for success and error handling, and the chaining of promises for sequential execution.', 'duration': 183.53, 'highlights': ['The chapter explains the concept of promises in jQuery, which represent the state of an AJAX request, either resolving with data or rejecting with error details. The transcript introduces the concept of promises in jQuery, illustrating that they represent the state of an AJAX request, either resolving with data or rejecting with error details.', 'It details the use of the then function for handling success and error cases of the promises, allowing the execution of specific functions based on the resolution or rejection of the promise. The transcript elaborates on the usage of the then function, which allows handling success and error cases of promises, enabling the execution of specific functions based on the resolution or rejection of the promise.', 'The chapter emphasizes the capability of chaining promises using the then function, where the return value of one then function is passed to the next, facilitating sequential execution. The transcript highlights the capability of chaining promises using the then function, enabling the return value of one then function to be passed to the next, facilitating sequential execution.']}], 'duration': 244.547, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk277385.jpg', 'highlights': ['Promises are a standard syntax for delayed responses in JavaScript, and should be used in well-built libraries or frameworks, with AJAX being a common example.', 'Using promises in JavaScript results in cleaner and better-looking code, reducing the need for repeated and unnecessary code.', 'Developers should understand the concept of promises, as they represent a future value and lead to cleaner, better code.', 'The chapter explains the concept of promises in jQuery, which represent the state of an AJAX request, either resolving with data or rejecting with error details.', 'It details the use of the then function for handling success and error cases of the promises, allowing the execution of specific functions based on the resolution or rejection of the promise.', 'The chapter emphasizes the capability of chaining promises using the then function, where the return value of one then function is passed to the next, facilitating sequential execution.']}, {'end': 843.343, 'segs': [{'end': 577.212, 'src': 'embed', 'start': 549.259, 'weight': 0, 'content': [{'end': 553.001, 'text': 'Basically no matter what you do, the last error function gets the error.', 'start': 549.259, 'duration': 3.742}, {'end': 561.444, 'text': 'Now earlier versions of jQuery I believe do not do this correctly, but the latest version of jQuery does do this correctly.', 'start': 553.321, 'duration': 8.123}, {'end': 564.585, 'text': "So that's pretty much what a promise is.", 'start': 561.964, 'duration': 2.621}, {'end': 567.227, 'text': 'You can see that I can also do something like this.', 'start': 565.206, 'duration': 2.021}, {'end': 574.01, 'text': "Let's say, what if you want to do several things at once? Every promise library gives you methods to do multiple things at the same time.", 'start': 567.267, 'duration': 6.743}, {'end': 577.212, 'text': "So here we can say, let's get profile.", 'start': 574.591, 'duration': 2.621}], 'summary': 'Jquery latest version correctly handles error functions and promises for multiple tasks.', 'duration': 27.953, 'max_score': 549.259, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk549259.jpg'}, {'end': 732.886, 'src': 'embed', 'start': 685.866, 'weight': 1, 'content': [{'end': 691.068, 'text': 'So if any of these errors anywhere along the way, then the error will get handled.', 'start': 685.866, 'duration': 5.202}, {'end': 693.289, 'text': 'It will fire this handle error function.', 'start': 691.568, 'duration': 1.721}, {'end': 693.989, 'text': 'So there you go.', 'start': 693.329, 'duration': 0.66}, {'end': 695.409, 'text': "That's promises.", 'start': 694.509, 'duration': 0.9}, {'end': 699.391, 'text': "It's way nicer, way less code, way more stable.", 'start': 695.609, 'duration': 3.782}, {'end': 704.373, 'text': "But if you look at it and you're honest with yourself, it's still kind of messy.", 'start': 700.631, 'duration': 3.742}, {'end': 709.355, 'text': 'It still is just a lot of dot then, return dot then.', 'start': 705.794, 'duration': 3.561}, {'end': 713.377, 'text': 'It still feels like programming should make more sense.', 'start': 709.836, 'duration': 3.541}, {'end': 723.682, 'text': "So let's look into a new thing which is coming in JavaScript 6, ES6 Harmony, which you can actually start using today using Google Tracer.", 'start': 713.437, 'duration': 10.245}, {'end': 729.684, 'text': 'which will convert your javascript to es6 harmony.', 'start': 725.561, 'duration': 4.123}, {'end': 731.185, 'text': "let's look at generators.", 'start': 729.684, 'duration': 1.501}, {'end': 732.886, 'text': "you can see i'm going to turn this on.", 'start': 731.185, 'duration': 1.701}], 'summary': 'Javascript promises are more stable, but es6 generators offer a cleaner alternative.', 'duration': 47.02, 'max_score': 685.866, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk685866.jpg'}], 'start': 521.932, 'title': 'Javascript promises and es6 generators', 'summary': "Covers javascript promises, emphasizing error function chaining and the latest jquery version. it also introduces es6 harmony with google tracer, highlighting generators' asynchronous functionality and clean code production.", 'chapters': [{'end': 567.227, 'start': 521.932, 'title': 'Understanding javascript promises', 'summary': 'Explains the chaining of error functions in javascript promises, emphasizing that the latest version of jquery correctly handles this feature.', 'duration': 45.295, 'highlights': ['The latest version of jQuery correctly chains error functions in promises, ensuring that the last error function always receives the error.', 'Promises in JavaScript can chain error functions, providing a mechanism for handling errors in asynchronous code execution.', 'Chaining error functions in promises allows for easier error handling and ensures that the last error function receives any errors.']}, {'end': 709.355, 'start': 567.267, 'title': 'Using promise libraries for concurrent operations', 'summary': 'Explains how to use promise libraries such as jquery.when, bluebird, and q to execute multiple asynchronous operations concurrently, ensuring that they all succeed before executing a function, leading to a more concise and stable code.', 'duration': 142.088, 'highlights': ['Promise libraries provide methods to execute multiple operations concurrently, such as getting a profile and starting the get friend process, and then using jQuery.when to wait for both to succeed and then execute a function.', 'Bluebird, jQuery.when, and Q offer similar functionalities for handling concurrent operations, using promise.all, when.all, and q.all, respectively.', 'Using promise libraries for concurrent operations leads to a more concise and stable code, reducing the need for numerous dot then and return dot then statements.']}, {'end': 843.343, 'start': 709.836, 'title': 'Es6 generators in javascript', 'summary': 'Introduces es6 harmony with google tracer, which allows the conversion and execution of javascript to es6 harmony, focusing on the feature of generators and their asynchronous functionality, emphasizing the clean and readable code it produces.', 'duration': 133.507, 'highlights': ['ES6 Harmony introduced with Google Tracer for converting and executing JavaScript to ES6 Harmony ES6 Harmony and Google Tracer allow the conversion and execution of JavaScript to ES6 Harmony, enabling the utilization of new features such as generators.', 'Generators in ES6 Harmony provide clean and readable code ES6 generators enable the creation of clean and readable code, enhancing the overall code quality and maintenance.', 'ES6 generators allow for asynchronous functionality without blocking the code ES6 generators enable asynchronous functionality without blocking the code, providing a smoother and more efficient execution process.']}], 'duration': 321.411, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/obaSQBBWZLk/pics/obaSQBBWZLk521932.jpg', 'highlights': ['The latest version of jQuery correctly chains error functions in promises, ensuring that the last error function always receives the error.', 'ES6 Harmony introduced with Google Tracer for converting and executing JavaScript to ES6 Harmony ES6 Harmony and Google Tracer allow the conversion and execution of JavaScript to ES6 Harmony, enabling the utilization of new features such as generators.', 'Using promise libraries for concurrent operations leads to a more concise and stable code, reducing the need for numerous dot then and return dot then statements.']}], 'highlights': ['The chapter emphasizes the importance of finding cleaner and more efficient solutions for handling async operations.', 'JavaScript async operations allow starting something that completes later, essential for newer developers to understand.', 'The callback way of handling async operations is depicted as messy and headache-inducing, emphasizing the need for cleaner and more manageable code.', 'The chapter discusses refactoring JavaScript callbacks to avoid the pyramid of doom and callback hell.', 'The clean callbacks code simplifies the process and makes the code cleaner and more manageable.', 'The need for abstracting out the callbacks into their own function is emphasized.', 'Promises are a standard syntax for delayed responses in JavaScript, and should be used in well-built libraries or frameworks, with AJAX being a common example.', 'Using promises in JavaScript results in cleaner and better-looking code, reducing the need for repeated and unnecessary code.', 'Developers should understand the concept of promises, as they represent a future value and lead to cleaner, better code.', 'The chapter explains the concept of promises in jQuery, which represent the state of an AJAX request, either resolving with data or rejecting with error details.', 'It details the use of the then function for handling success and error cases of the promises, allowing the execution of specific functions based on the resolution or rejection of the promise.', 'The chapter emphasizes the capability of chaining promises using the then function, where the return value of one then function is passed to the next, facilitating sequential execution.', 'The latest version of jQuery correctly chains error functions in promises, ensuring that the last error function always receives the error.', 'ES6 Harmony introduced with Google Tracer for converting and executing JavaScript to ES6 Harmony ES6 Harmony and Google Tracer allow the conversion and execution of JavaScript to ES6 Harmony, enabling the utilization of new features such as generators.', 'Using promise libraries for concurrent operations leads to a more concise and stable code, reducing the need for numerous dot then and return dot then statements.']}