16
ES6 ECMA 2015

ES6 ECMA2015

Embed Size (px)

Citation preview

Page 1: ES6 ECMA2015

ES6ECMA 2015

Page 2: ES6 ECMA2015

ES6 Compatibility

https://kangax.github.io/compat-table/es6/

This tutorial uses Babel + Polyfills

Page 3: ES6 ECMA2015

Babelnpm install —save-dev babel-cli

npm install babel-preset-es2015npm install babel-preset-stage-0

.babelrc

Page 4: ES6 ECMA2015

npm

babel src -d out

“babel-cli” : “^6.5.1”

npm run build

Page 5: ES6 ECMA2015

WebStorm

watches JS files, transpiles them on the spot.

Page 6: ES6 ECMA2015

String Template & Interpolation

` ${val} `

Page 7: ES6 ECMA2015

Decompose

Page 8: ES6 ECMA2015

Array & Map

let of to iterate an array or a map

Page 9: ES6 ECMA2015

Arrow Function (Lambda)( param1, param2 ) => { statements}

Page 10: ES6 ECMA2015

High Order Functionsmap, filter, forEach

Page 11: ES6 ECMA2015

Class

Page 12: ES6 ECMA2015

Export & Importimport {func} from ‘filename’

import * as xxx from

This needs to point to the compile code.

Page 13: ES6 ECMA2015

Promisesreplace Callbacks with Promises.

Chain of Promises

Page 14: ES6 ECMA2015

Promises

Wait for all the promises done.

Page 15: ES6 ECMA2015

Generators (yield)

npm install babel-polyfill

Page 16: ES6 ECMA2015

Generators

let us invoke async functions synchronously.

or

randevu