ES6 Tutorial
ECMAScript 2015 or ES2015 is a significant update to the JavaScript programming language. It is the first major update to the language since ES5 which was standardized in 2009. Therefore, ES2015 is often called ES6.
To follow this ES6 tutorial, you should have a good knowledge of JavaScript up to ES5.
Section 1. New ES6 syntax
- let – declare block-scoped variables using the
let
keyword. - let vs. var – understand the differences between
let
andvar
. - const – define constants using the
const
keyword. - Default function parameters – learn how to set the default value for parameters of a function.
- Rest parameter – introduce you to the rest parameter and how to use them effectively.
- Spread operator – learn how to use the spread operator effectively.
- Object literal syntax extensions – provide a new way to define object literal.
- for…of – learn how to use the
for...of
loop to iterate over elements of an iterable object. - Octal and binary literals – provide support for binary literals and change the way to represent octal literals.
- Template literals – learn how to substitute variables in a string.
Section 2. Destructuring
- Array Destructuring – show you how to assign elements of an array to variables.
- Object Destructuring – learn how to assign properties of an object to variables.
Section 3. ES6 Modules
- ES6 modules – learn how to write modular JavaScript code.
Section 4. ES6 Classes
- Class – introduce you to the ES6 class syntax and how to declare a class.
- Getters and Setters – define the getters and setters for a class using the get and set keywords.
- Class Expression – learn an alternative way to define a new class using a class expression.
- Static methods – guide you on how to define methods associated with a class, not instances of that class.
- Static Properties – show you how to define static properties shared by all instances of a class.
- Computed property – explain the computed property and its practical application.
- Inheritance – show you how to extend a class using the
extends
andsuper
keywords. - new.target – introduce you to the
new.target
metaproperty.
Section 5. Arrow Functions
- Arrow functions – introduce you to the arrow functions (
=>
) - Arrow functions: when you should not use – learn when not to use the arrow functions.
Section 6. Symbol
- Symbol – introduce you to a new primitive type called
symbol
in ES6
Section 7. Iterators & Generators
- Iterators – introduce you to the iteration and iterator protocols.
- Generators – develop functions that can pause midway and then continue from where they paused.
- yield – dive into how to use the
yield
keyword in generators.
Section 8. Promises
- Promises – learn about Javascript Promises, what they are, and how to use them effectively.
- Promise chaining – show you how to execute multiple asynchronous operations in sequence.
- Promise composition:
Promise.all()
&Promise.race()
– learn how to compose a new promise out of several promises. - Promise error handling – guide you on how to handle errors in promises.
Section 10. Array extensions
- Array.of() – improve array creation.
- Array.from() – create arrays from array-like or iterable objects.
- Array find() – find an element in an array
- Array findIndex() – find the index of an element in an array.
Section 11. Object extensions
- Object.assign() – copy an object or merge objects.
- Object.is() – check if two values are the same value.
Section 12. String extensions
- String startsWith() – check if a string starts with another string.
- String endsWith() – determine if a string ends with another string.
- String includes() – check if a string contains another string.
Section 13. Proxy & Reflection
- Proxy – learn how to use the proxy object that wraps another object (target) and intercepts the fundamental operations of the target object.
- Reflection – show you how to use ES6 Reflection API to manipulate variables, properties, and methods of objects at runtime.