a walkthrough of javascript es6 features

13
ECMAScript 6 Features (and some JavaScript background) Conny Brunnkvist (@connyb), developer at HotelQuickly

Upload: michal-juhas

Post on 09-Feb-2017

472 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: A walkthrough of JavaScript ES6 features

ECMAScript 6 Features (and some JavaScript background)

Conny Brunnkvist (@connyb), developer at HotelQuickly

Page 2: A walkthrough of JavaScript ES6 features

Eck!?ECMA is the European Computer Manufacturer's Association.

ECMAScript is formally governed by a technical committee

- ES/JS (used interchangeably) is NOT part of W3C

- Many implementations: Google V8, Mozilla SpiderMonkey, Microsoft Chakra, WebKit JSCore, etc...

Page 3: A walkthrough of JavaScript ES6 features

JS History- A language is originally created by Brendan Eich

- Originally Mocha, became LiveScript, later renamed JavaScript

- Standards track initiated 1996 by Netscape

Page 4: A walkthrough of JavaScript ES6 features

- Assigned specification name: ECMA-262

- Formed technical committee: TC-39

- Language documented as “ECMAScript” due to of trademark issues

JS History

Page 5: A walkthrough of JavaScript ES6 features

JS HistorySince the start, and up until today:

ECMAScript === JavaScript

...at least in speech ;-)

Page 6: A walkthrough of JavaScript ES6 features

Dec 1999, ES3: what most of us traditionally expect when we see ”JavaScript”

Abandoned Jul 2008, ES3.1 & ES4: following a very long ongoing disagreement in the committee about the scope of changes

Dec 2009, ES5: designed as an incremental update. Most notable feature: ”strict mode”;

Jun 2011, ES5.1: maintenance release covering adopted by the ISO

~2013, ES.next: ”harmonized” turned out too ambitious, features split into two groups: ”likely” and “less prioritized”

Jun 2015, ES6: “ES-2015” draft finally finished, standard published as ”ECMAScript 6”.

(now, ES7: Still WIP!)

Page 7: A walkthrough of JavaScript ES6 features

Dec 1999, ES3: what most of us traditionally expect when we see ”JavaScript”

Abandoned Jul 2008, ES3.1 & ES4: following a very long ongoing disagreement in the committee about the scope of changes

Dec 2009, ES5: designed as an incremental update. Most notable feature: ”strict mode”;

Jun 2011, ES5.1: maintenance release covering adopted by the ISO

~2013, ES.next: ”harmonized” turned out too ambitious, features split into two groups: ”likely” and “less prioritized”

Jun 2015, ES6: “ES-2015” draft finally finished, standard published as ”ECMAScript 6”.

(now, ES7: Still WIP!)

Dec 1995, Netscape Enterprise Server used server-side JavaScript

Dec 1996, Microsoft IIS enabled JScript server-side scripting

~~~

2008-2009, Initial start on a V8-powered server by Ryan Dahl (at Joyent)

2009, Project renamed ”Node” and later presented to the public

Dec 2014, io.js was forked ...

May 2015, io.js and Node.js both voted to merge again)

Page 8: A walkthrough of JavaScript ES6 features

ECMAScript 6 vs ECMAScript Harmony

What is the difference here!?

- ES5 -> ES6 process took years

- It’s all flags in Google V8

Page 9: A walkthrough of JavaScript ES6 features

Harmony in Node.jsEnabling “standard” harmony mode in node 0.6.x in 2011:- node --harmony_typeof --harmony_block_scoping --harmony_proxies --harmony_weakmaps

In node 0.7.x:- node --harmony

Page 10: A walkthrough of JavaScript ES6 features

“Recent” changes to Node.js version numbers

- io.js @ 3.x

- Node.js @ 0.12.x

MERGED = Node.js release 4.0.0 a.k.a. “the new 1.0.0!”

Page 11: A walkthrough of JavaScript ES6 features

All shipping features, which V8 considers stable, are turned on by default on Node.js and do NOT require any kind of runtime flag.

Staged features, which are almost-completed features that are not considered stable by the V8 team, require a runtime flag: --es_staging (or its synonym, --harmony).

In progress features can be activated individually by their respective harmony flag (e.g. --harmony_destructuring), although this is highly discouraged unless for testing purposes.

(Complete answer: Check with node --v8-options !!!)

But what is in Node.js now?

Page 12: A walkthrough of JavaScript ES6 features

● arrows● classes● enhanced object literals● template strings● destructuring● default + rest + spread parameters

operators● let + const● iterators + for..of● generators● unicode literals + regexps

● modules● module loaders● map + set + weakmap +

weakset● proxies● symbols● subclassable built-ins● promises● math + number + string + array

+ object APIs● binary and octal literals● reflect api● tail calls

Features. Lots of them.

Page 13: A walkthrough of JavaScript ES6 features

Further information about language featurs can be found at:● ECMAScript 6 features:

https://github.com/lukehoban/es6featureshttp://es6-features.org/

● Current ECMAScript 6 features in Node.js:https://nodejs.org/en/docs/es6/

Thank you for watching, lets hack the REPL!