Sweet ES2015 (ES6) Taste

Preview:

Citation preview

Sweet ES2015 (ES6) TasteDamir Širola

Variable declaration

var – hoisted

let – block scoped variable declaration

const – block scoped, immutable

Arrow function

Simpler syntax

Implicit return

Share “this” from surrounding scope (avoids that =

this or bind)

Modules

Avoid global variables

Code encapsulation (Only exported members are

visible to import)

Classes

Single standard with simple syntax

(react.createClass, new…)

Easy inheritance

Use this to access instance properties and

methods

Promises

JavaScript is single threaded so asynchronous

execution is required

Promises allow us to avoid callback hell

Easier error handling

Object destructuring

Binding values to variables using pattern matching

Pattern match based on name

Useful for imports and for function parameters with

default values

Useful links

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

http://es6-features.org/

Demo source code

https://github.com/axilis/sweet-es-2015-taste

Questions?

Discussion!