
In this lesson, we will take a close look at the JavaScript variables. You will be surprised how little you know about it.
There are two ways we can create a variable in JS: var and let. We will start with var.
In this lesson, we will take a close look at let and find out all the differences between it and var.
In this lesson, we will show you how to use constant. Just like let, constant is also a new feature introduced by ES6. It also has the same characteristics as let.
Unlike variables, constant value cannot be changed. This is why it is called constant.
LET will create a TDZ, in this lesson, you will learn everything about TDZ.
In this lesson, we will take a look at the real-life application of let.
Demonstrate how var hoists to the scope top and yields undefined before declaration, while function declarations hoist with their bodies, and that arguments act as variables with the lowest priority.
Explore how JavaScript functions are objects via the function constructor, inspect length and name, distinguish arguments from the arguments variable, and learn about caller and callee, plus arrow functions.
Explain how this behaves in methods versus functions, why set timeout callbacks lose context, and how to use bind, apply, and call to redirect this and enable currying of arguments.
Identify higher-order functions as those that take functions as arguments or return one. Apply currying, converting multi-argument functions into nested single-argument calls, to avoid duplicated computation and gain control.
Apply currying and closure to track a running total cost in the global scope, where a curry cost function returns a child function sharing the same total across invocations.
Learn how closures simulate block scope by returning an inner function from a parent function, enabling access to outer variables while keeping them protected, with anonymous function variants.
Discover the real-life application of closures by using function scope to replace let with var, creating three independent K variables.
Explore the syntax of arrow functions, a concise alternative to traditional functions. Assign them to variables, omit parentheses for one argument, and return values with optional braces and defaults.
Compare this in traditional functions and arrow functions, showing how arrow this inherits from an outer function defined with function, and when it points to window or global object.
Explore how arrow functions bind this in JavaScript: inherit in setTimeout but fail in forEach when resetting this to an object, revealing when they help and when they hinder.
Destructuring assignment allows us to quickly retrieve values from an array or an object and assign them to variables. It also allows us to set default variable values.
In this lesson, we will show you how to destructure an array.
In this lesson, we will learn how to destructure objects.
In this lesson, we will learn how to destructure a string.
String is very special. We can destructure it as an array or as an object.
The conclusion is we can only destructure an array or an object.
String can be destructured as either an array or an object.
Number and Boolean will be regarded as an object. Destructuring them means destructuring their prototype.
Null and undefined cannot be destructured at all.
In this lesson, we will take a look at another real-life application of destructuring: setting values for function arguments.
Explore map basics: an enhanced key-value collection with insertion order, where values may duplicate but keys are unique, using the map constructor and set, get, has, delete, and clear.
Learn to iterate over maps in JavaScript with forEach and for...of. Use destructuring to access keys and values, and leverage keys, values, and entries for map iteration.
Explore the ES6 set data type, a unique-values collection that preserves insertion order and removes duplicates by converting arrays to sets with the set constructor and the add method.
Merge two arrays with the spread operator, remove duplicates via a set to form union. Filter list one against the other to get intersection, and invert conditions for difference.
Learn how symbols serve as unique property names in JavaScript, preventing naming collisions when extending objects, by invoking the symbol function (and not using new) with an optional string description.
Create and compare symbol values by invoking the symbol function, noting their uniqueness and optional descriptions; understand wrapper objects and symbol prototype in projects, and their use as property names.
Compare symbol and symbol for method: symbol for method returns a shared symbol by key, while symbol creates a new symbol each time.
Learn how to use a symbol as a property name in an object, including using square brackets, understanding non-enumerable properties, and retrieving symbol properties with get own property symbols.
Learn how well-known symbols enable for-of iteration in strings, arrays, maps, and sets via the symbol iterator, and how map.prototype options like entries, values, and keys determine the output.
FOR OF is for iterating over an iterable object. For an object to be iterable, it must meet the demands of the iteration protocol.
The iteration protocol includes two parts: the iterable protocol and the iterator protocol.
The iterable protocol requires the object to have a method under the name of symbol dot iterator. This method cannot have any arguments and must return an object. The returned object is the iterator object.
The iterator protocol specifies rules for the returned object.
It requires the object to have a next method. The next method must return an object with at least two properties: value and done.
Create a custom iterator that follows the iterable and iterator protocols, uses next and for of to capitalize each array value during iteration.
Explore how generator objects implement both the iterable and iterator protocols, using next and yield to control execution and preserve context, often with promises to simplify callbacks.
Convert a linear function into a generator with five yields to control tasks—user ID check, database connection, and more—using next, return, and throw to manage iteration and errors.
Explore how the next() method passes values into a generator by yielding to variables, and why first next cannot send a value, requiring extra yield to set brand and model.
Explore two generator functions and how yield and yield asterisk enable iterating strings, arrays, and a generator object, yielding fruit, vegetable, dairy from the first and values from the second.
A promise is an object that represents the execution result of an async operation.
The execution result is unpredictable and can either be successful or failed. There are no other possibilities.
Since we cannot predict the execution result, we have to prepare for both possibilities.
The codes we write for the two possibilities are best stored in two independent callback functions. Do you know why?
A function is a block of codes that will not be executed unless the function is invoked. By defining codes inside a function, we can control the execution timing and location of those codes.
Because the result of the async operation is unknown, therefore, we cannot decide which block of codes should be executed. Naturally, putting them in two callback functions is the best choice.
Promise offers us a better way to arrange those callback functions. We can attach callbacks to the promise object, instead of passing them into a function.
Three key factors: the executor function, the resolve function and the reject function.
Build a promise-based ajax program in native JavaScript by creating a myAjax function that resolves on status 200 and rejects otherwise, using then, catch, and finally to output JSON.
Learn how the thenable object interacts with resolve and reject to produce a success value for on fulfilled and a failure reason for on rejected, with finally executing after settlement.
Directly creating a resolved and rejected promise object.
Explore what happens when replacing the Promise constructor with Promise.resolve and Promise.reject, and use setTimeout to fulfill after two seconds, triggering then and catch.
Master handling multiple promises with race, allSettled, and all by processing an array of promises and retrieving value or reason for each settled result.
Explore using async and await with Axios to exchange data, replace then and catch with try and catch, and write concise code by prefixing functions with async and awaiting promises.
Explore how async/await controls a JavaScript promise and setTimeout to ensure the console logs output in order, requiring a resolve function and awaiting the callback.
Explore the reflect object in JavaScript, learning its 13 static methods as alternatives to built-in operators, including apply, has, deleteProperty, and construct, and how to re-point this without using new.
Explain how a proxy defines custom behavior for operations using a target and handler, with traps like get that can capitalize the engine and deny other properties.
Explore how the proxy get trap intercepts property access to create private properties, returning access denied for underscored names while preserving normal values for others.
Using the get method, the proxy set trap prevents resetting underscore ID and throws an error, while normal properties can reset and new properties trigger interception and capitalization.
Explore the has and deleteProperty traps to guard private properties by replacing in with reflect.has and preventing deletion of underscores-prefixed properties.
Explore proxy object prototypes, where inherited get and set traps cause unexpected results and underscore proto access issues, and use object defined property or reflect defined property for safe addition.
Explore how the defineProperty trap intercepts property additions on a proxy, manipulates descriptors, and uses Reflect to properly set writable, enumerable, and configurable attributes.
Explore how the apply trap in a proxy intercepts a function call, redefining the this value and argument list, and intercepting the call method.
Explore using the new operator with the construct trap and a proxy to intercept constructor calls, return an object, and create static properties via the new target, while capitalizing arguments.
discover how to create a revocable proxy with Proxy.revocable, returning a wrapper with a proxy and revoke method, and how revocation sets is revoked to true, making the proxy unusable.
Explore how ES6 proxy and reflect intercept read and write operations with a handler and getter/setter. See how a proxy can envelop an object and power two-way data binding.
This is the course that scratches the itch!
This is a JavaScript enhancement course, designed to help junior JavaScript developers gain a wider and deeper understanding of JavaScript.
What you will learn:
You will learn ES6 new features like destructuring assignment, async/await, reflect, proxy, symbol, iterator, generator, etc.
Then you will learn the JavaScript object system and prototypal inheritance in the most detailed way. You will learn every method the Object constructor has.
To completely understand how JavaScript works, you will learn advanced topics like thread, process, stack, queue, heap, task queue, event loop, recursion, deep and shallow object copy, etc.
To further boost your coding skills, you will also learn 8 sorting algorithms: bubble sorting, cocktail sorting, quick sorting, counting sorting, insertion sorting, bucket sorting, selection sorting, and heap sorting.
You will also develop a proper understanding of linear and non-linear data structures, including array, linked list, binary search tree, max heap, min heap, etc.
What you will achieve:
After this course, you will develop a solid JavaScript knowledge base and most importantly, gain a deep understanding of how JavaScript works under the hood. This knowledge can help you create more efficient programs and succeed in job interviews.
If you need to learn JS frameworks like Vue, React, and Angular, a solid knowledge foundation in JavaScript can tremendously accelerate your study.
Throughout the course, you will also learn how to answer questions that are frequently seen in job interviews.
Content highlights:
Lecture 1, 2: Everything you need to know about var and let [FREE Preview]
Lecture 6: Priority comparison: variable name, function name, and argument name
Lecture 9, 10: Higher-order function and currying
Lecture 11, 12: Closure and its real-life application [FREE Preview]
Lecture 68, 69, 70, 71: The JavaScript prototype chain
Lecture 85: two-way data binding
Lecture 103: Data structure: Queue, Stack, and Heap [FREE Preview]
Lecture 104: Thread and Process, sync and async, blocking and non-blocking
Lecture 105: Recursion and stack overflow
Lecture 107: Event loop
Lecture 108: Interview challenges: predict the result of the following programs using event loop, macro and micro task queue
Lecture 110, 111: tail call optimization
Lecture 114, 115, 116, 117: creative inheritance program design
Lecture 120, 121: 'Deep' copy and assign objects
Lecture 122, 123: JavaScript garbage collection, reference count, and the mark-and-sweep algorithm
Lecture 124, 125, 126, 127: Basic computing knowledge: bit, byte, memory address, byte addressing, bit width, encoding
Lecture 142, 153, 144: Type coercion, wrapper object, explicit and implicit typecasting
Lecture 151-163: Bubble sorting
Lecture 164, 165: Cocktail sorting
Lecture 166, 167: Quick sorting
Lecture 168, 169, 170, 171: Counting sorting
Lecture 172, 173: Insertion sorting
Lecture 174. 175: Bucket sorting
Lecture 176, 177: Selection sorting
Lecture 178: Time and space complexity and the big O notation
Lecture 179, 180: Linear and non-linear data structures: array, linked list, binary search tree, max heap, min heap, etc.
Lecture 181, 182, 183, 184: binary heap and heap sorting
Lecture 185, 186, 187: the Observer pattern and two-way data binding using the Observer pattern
Please Note: This is NOT a beginner course and does not cover JS DOM and jQuery.