es6 or es2015 cheat sheet - qianxueseng-com/guides GitHub Wiki
ES6 or ES2015
Block scoping
let is the new var.
// Block scoping (let)
function fn () {
let x = 0;
if (true) {
let x = 1; // only inside this `if`
}
}
// Constants
const a = 1;
Promises
- For asynchronous programming.
new Promise(fn)
.then(fn)
.catch(fn)
Promise.all(/*...*/)
Promise.race(/*...*/)
Promise.reject(/*...*/)
Promise.resolve(/*...*/)