What is JavaScript....7
Course Overview....7
Prerequisites....7
Running code examples....8
Who is this course for?....8
History of JavaScript....9
Standardization of the JavaScript language....10
Ecma International, TC39....10
Proposals process....11
Track upcoming features....13
How is ECMAScript versioned?....13
JIT Compiler....15
JavaScript Engine....16
Types of execution contexts....21
Execution context phases....22
Stack overflow....35
Automatic garbage collection....37
Hoisting....38
“var” declarations....38
Function declarations....39
Function declarations inside blocks....40
Class declarations....44
Temporal Dead Zone (TDZ)....45
Function and class expressions....46
Common misconception about hoisting....47
Scope....49
Lexical scope....49
Avoid polluting the global scope....51
Implicit globals....52
Shadowing declarations....54
Function parameter scope....55
Function expression name scope....58
Block Scope....59
Module Scope....59
Scope Chain....60
Coercion....63
ToPrimitive....65
ToNumber....75
ToString....76
ToBoolean....77
Summary of abstract equality operator....78
Addition Operator....82
Relational operators....83
Closures....92
What is a closure?....92
How do closures work?....93
How are different scopes linked?....95
What causes this problem?....102
How to resolve this problem?....103
Prototypes....111
How are objects linked?....111
The “prototype” property....112
Getting prototype of any object....114
Object.prototype - parent of all objects....115
“Function” function....118
Problems with __proto__....121
Object.create method....123
Null prototype object....123
ES2015 classes....128
‘this’ keyword....130
Function context....130
Global context....132
Constructor function context....133
Class context....133
DOM event handler context....134
Arrow functions to the rescue....138
Borrowing methods....142
Chain constructor calls....143
Revisit “this” problem....144
“this” vs globalThis....146
Symbol....149
Symbols and privacy....151
Adding a description to symbols....153
Symbol.toPrimitive....156
Symbol.toStringTag....156
Symbol.isConcatSpreadable....157
Asynchronous JavaScript....159
What does asynchronous mean?....159
Asynchronous JavaScript....160
Problems with callbacks....164
What is an event loop?....167
Promise states....172
Promise instance methods....173
Creating promises....176
Using promises with callback-based API....178
Promise specification....179
Promise vs thenable....179
then promise....182
catch promise....186
finally promise....190
Making sense of promise chaining....193
Rejection handler in then vs catch....202
Concurrent requests....203
Request timeout....204
async functions....208
await keyword....210
Multiple await expressions....212
Error handling....214
Returning vs awaiting promise....215
Awaiting non-promise value....219
Unnecessary use of the Promise Constructor....227
Incorrect Error Handling....228
Converting promise rejection into fulfillment....230
Async executor function....232
Iterators and Generators....234
Iterables....234
Iterators....235
Iterator prototype....237
Making custom iterable objects....239
Infinite sequence....242
Implementing iterators....243
Consuming values....244
Delegating to other iterators....246
Further reading....247
for await…of loop....251
Debugging JavaScript....252
Wrap up....261
Understand the confusing parts of JavaScript - Become a confident JavaScript pro by unraveling the most challenging aspects of the language. With easy-to-understand explanations and code examples, you’ll gain a solid understanding of JavaScript's most complex features in Advanced JavaScript Unleashed.
With the continued popularity of JavaScript frontend frameworks like React, Vue, or Angular, having a solid understanding of the more complicated parts of JavaScript is more important than ever. And with JavaScript being a dynamically typed language, it has some quirks. Some of its features can be confusing or hard to understand, for beginners and intermediate developers alike.
After answering the questions of hundreds of JavaScript developers, Unpacking Intermediate JavaScript book author, Yousaf Khan, realized that the same few topics kept coming up over and over. There were fundamental aspects of JavaScript that developers were missing!
This book aims to make it attainable for anyone to develop a deeper understanding of JavaScript by providing easy-to-understand explanations of all the important and hard-to-understand topics that keep many devs stagnant, producing the most bugs and unmaintainable code.
Unpacking Intermediate JavaScript aims to make it attainable for anyone to develop a deeper understanding of the JavaScript language by providing clear and concise explanations of core mid-level topics. The book will cover closures, coercion, asynchronous nature of Javascript, hoisting, and event loop. But also dive into advanced topics like promises, async-await, and more.
With multiple popular frontend JavaScript frameworks in use today (React, Vue, or Angular,) having a solid understanding of JavaScript makes it easy to learn and work with these frameworks.The carefully curated knowledge presented in this book will help you develop a solid understanding of the JavaScript language, and in turn will make it easy for you to work with different JavaScript frameworks.