Summary
This chapter was about JavaScript and Node.js internals.
First, we started our discussion with JavaScript internals. The main point was to understand the JavaScript engine and the JavaScript runtime. JavaScript is a single-thread language, but it has an async nature and we’re able to use callbacks and promises to implement it. In async programming, callbacks are a bit old school nowadays thanks to promises. We also talked about the Promise API and learned a lot of interesting functions.
The popularity of promises brings other interesting features to JavaScript: async/await. Using examples, we tried to demonstrate how they make our code more readable, understandable, and similar to sync code.
For promises, we have a special queue in the JavaScript engine pipeline called the microtask queue.
Then we started a discussion around Node.js and learned that it is also a runtime and uses the JavaScript engine to read and translate JavaScript code. It takesJavaScript...