ECMAScript 6 (ES6) is the most recent standard specification for JavaScript, the programming language used on the Web. With the emergence of HTML5 and Node.js, a runtime environment that enables JavaScript execution on servers and desktops, JavaScript has experienced significant growth. Its adoption rate has increased among businesses incorporating it into production, leading to high anticipation for its latest features.
This cheat sheet serves as a compilation of ES6 features we employ daily. While aiming for comprehensiveness and conciseness, new API methods are excluded. For those seeking such information, we recommend conducting a quick search or exploring the MDN documentation to discover the latest experimental APIs. However, some cutting-edge features, like async and await from the upcoming specification draft (ES7), are included because many developers will utilize a transpiler like Babel to leverage the latest JavaScript capabilities.
To experiment with the provided tips, you can execute the node REPL using the following command:
| |
Alternatively, use a babel-node directly to maximize JavaScript utilization in your console.

Click Here To Download JavaScript ES6 Cheat Sheet
JavaScript (ES6 and Beyond) Cheat Sheet
Constants | let vs var | |
> const EULER = 2.7182818284 | > var average = 5 | |
Warning! If array or object, the reference is kept constant. If the constant is a reference to an object, you can still modify the content, but never change the variable. | ||
> const CONSTANTS = [] | Be aware of Temporal Dead Zones: | |
> console.log(val) // -> 'undefined' | ||
Because it's equivalent to: | ||
Binary, Octal and Hex Notation | > var val | |
> 0b1001011101 // 605 | ||
Variables declared with "let/const" do not get hoisted: | ||
New Types | > console.log(val) | |
Symbols, Maps, WeakMaps and Sets | ||
Arrow Function | New Scoped Functions | |
> setTimeout(() => { | > { | |
Equivalent with Anonymous Function | Equivalent with Immediately Invoked Function Expressions (IIFE) | |
> setTimeout(function () { | > (function () { | |
Object Notation Novelties | String Interpolation, Thanks to Template Literals | |
// Computed properties // Object literals // Same as } | > const name = 'Tiger' // We can preserve newlines… | |
Default Params | ||
> function howAreYou (answer = ‘ok’) { | ||
Promises | Classes, Inheritance, Setters, Getters | |
new Promise((resolve, reject) => { | class Rectangle extends Shape { | |
Destructuring Arrays | Destructuring Objects | |
> let [a, b, c, d] = [1, 2, 3, 4]; | > let luke = { occupation: 'jedi', | |
Spread Operator | ...Go Destructuring Like a Boss | |
// Turn arrays into comma separated | > const [ cat, dog, ...fish ] = [ | |
Or Do a Better Push | ...And Destructuring in the Future ⚠ ES7 | |
> let arr = [1, 2, 3] | {a, b, ...rest} = {a:1, b:2, c:3, d:4} | |
Async ⚠ ES7 | Await ⚠ ES7 | |
async function schrodinger () { | try { | |
Export ⚠ ES7 | Importing ⚠ ES7 | |
export function sumTwo (a, b) { | import React from ‘react’ | |
Generators | ||
They return a objects that implement an iteration protocol. i.e. it has a next() method that returns { value: < some value>, done: <true or false> }. | ||
function* incRand (max) { // Asterisk defines this as a generator | ||
> var rng = incRand(2) // Returns a generator object | ||