11
Sweet ES2015 (ES6) Taste Damir Širola

Sweet ES2015 (ES6) Taste

  • Upload
    axilis

  • View
    175

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Sweet ES2015 (ES6) Taste

Sweet ES2015 (ES6) TasteDamir Širola

Page 2: Sweet ES2015 (ES6) Taste

Variable declaration

var – hoisted

let – block scoped variable declaration

const – block scoped, immutable

Page 3: Sweet ES2015 (ES6) Taste

Arrow function

Simpler syntax

Implicit return

Share “this” from surrounding scope (avoids that =

this or bind)

Page 4: Sweet ES2015 (ES6) Taste

Modules

Avoid global variables

Code encapsulation (Only exported members are

visible to import)

Page 5: Sweet ES2015 (ES6) Taste

Classes

Single standard with simple syntax

(react.createClass, new…)

Easy inheritance

Use this to access instance properties and

methods

Page 6: Sweet ES2015 (ES6) Taste

Promises

JavaScript is single threaded so asynchronous

execution is required

Promises allow us to avoid callback hell

Easier error handling

Page 7: Sweet ES2015 (ES6) Taste

Object destructuring

Binding values to variables using pattern matching

Pattern match based on name

Useful for imports and for function parameters with

default values

Page 8: Sweet ES2015 (ES6) Taste

Useful links

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

http://es6-features.org/

Page 9: Sweet ES2015 (ES6) Taste

Demo source code

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

Page 10: Sweet ES2015 (ES6) Taste

Questions?

Page 11: Sweet ES2015 (ES6) Taste

Discussion!