ES6
ECMA 2015
ES6 Compatibility
https://kangax.github.io/compat-table/es6/
This tutorial uses Babel + Polyfills
Babel
npm install —save-dev babel-cli
npm install babel-preset-es2015
npm install babel-preset-stage-0
.babelrc
npm
babel src -d out
“babel-cli” : “^6.5.1”
npm run build
WebStorm
watches JS files,
transpiles them on the spot.
String Template & Interpolation
` ${val} `
Decompose
Array & Map
let of to iterate an array or a map
Arrow Function (Lambda)
( param1, param2 ) => {
statements
}
High Order Functions
map, filter, forEach
Class
Export & Import
import {func} from ‘filename’
import * as xxx from
This needs to point to the compile code.
Promises
replace Callbacks with Promises.
Chain of Promises
Promises
Wait for all the promises done.
Generators (yield)
npm install babel-polyfill
Generators
let us invoke async functions synchronously.
or
randevu

ES6 ECMA2015