SlideShare une entreprise Scribd logo
1  sur  50
Télécharger pour lire hors ligne
ES6
Cory Forsyth
@bantic
Cory Forsyth
@bantic
JavaScript History
JavaScript is not a
Language
• JavaScript is an implementation of a language
• ActionScript was another implementation
• The name of the language is: ECMAScript
• JavaScript : ECMAScript :: Rubinius/JRuby : Ruby
JavaScript History
• Invented at Netscape by Brendan Eich
• Mocha -> LiveScript -> JavaScript
• 1996 -> Standardization taken by Ecma
• Renamed -> ECMAScript (trademark reasons)
ECMAScript
• What is Ecma?
• “Ecma International is an industry association …
dedicated to the standardization of Information and
Communication Technology”
• Its website slogan is: “Standards@Internet Speed”
Ecma Org Chart
Ecma Org Chart
• TC = Technical Committee
• TC39 = Technical Committee tasked with
ECMAScript ®
• TC39 Official Scope: “Standardization of the
general purpose, cross platform, vendor-neutral
programming language ECMAScript.”
• Ecma = European Computer Manufacturers
Association
ECMAScript
• 1997: ECMA-262: Language Standard
• On github (now): tc39/ecma262
• 1998 ES2
• 1999 ES3
ECMAScript
• 2000: ES4
ECMAScript
• 2000: ES4
ECMAScript
• 2000: ES4
• 2005: ES4
• Mozilla and Macromedia
• Big changes, major leap from ES5
ECMAScript
• 2000: ES4
• 2005: ES4
• Mozilla and Macromedia
• Big changes, major leap from ES5
• Divisive, Yahoo & Microsoft opposed
ECMAScript
• 2000: ES4
• 2005: ES4
• Mozilla and Macromedia
• Big changes, major leap from ES5
• Divisive, Yahoo & Microsoft opposed
ES5
• 2009 in Oslo
• “Modern” JavaScript
• Originally v3.1 (incremental change)
• “Harmony”
ES6
• Will be released in 2015
• After this, versions will be released yearly:
• ES2015
• ES2016
• …
ES2015: What’s New?
ES2015
• Syntax Changes
• New features
• Fixes
• Superset of ES5
if (true) {
var x = 'yes';
}
console.log(x); // 'yes'
if (true) {
let x = 'yes';
}
console.log(x); // ReferenceError
var is hoisted
let is block scope
`let` there be light scope
hoisting
function() {
console.log(x); // undefined
var x = 'foo';
console.log(x); // ‘foo’
}
hoisting
function() {
var x;
console.log(x); // undefined
x = 'foo';
console.log(x); // ‘foo’
}
`let` : temporal dead zone
function() {
console.log(x); // ReferenceError
// TDZ
let x = 'foo';
console.log(x); // ‘foo’
}
`let` there be sanity
let funcs = [];
for (var i=0; i < 5; i++) {
funcs.push(function() { alert(i); });
}
funcs[0]();
`let` there be sanity
let funcs = [];
for (let i=0; i < 5; i++) {
funcs.push(function() { alert(i); });
}
funcs[0]();
a new i for each turn of the loop
`const`
const x = 'foo';
x = 'bar'; // error
const x = {
foo: 'bar'
};
x.foo = 'baz'; // ok (!)
can modify properties of a const
cannot reassign const
use Object.freeze, Object.seal to
prevent changes to an object
Arrow functions =>
var x = function() {} let x = () => {}
• Has own scope
• Has `arguments`
• No implicit return
• “lexical” scope
• No `arguments`
• implicit return*
• *sometimes
Arrow functions =>
this.x = 'yes';
let y = () => {
"use strict";
console.log(this.x);
};
y(); // 'yes'
this.x = 'yes';
var y = function(){
"use strict";
console.log(this.x);
};
y(); // TypeError…
`this` is undefined `this` from outer scope
No need for var that = this, `bind` with
arrow functions
Arrow functions =>
1 arg: no parens, implicit return
let square = x => x * x;
let squares = [1,2,3].map(square);
console.log(squares) // [1,4,9]
Arrow functions =>
1 arg: no parens, implicit return
let square = x => x * x;
let squares = [1,2,3].map(square);
console.log(squares) // [1,4,9]
let add = (a,b) => a + b;
add(2,3); // 5
2 args: needs parens, implicit return
Arrow functions =>
1 arg: no parens, implicit return
let square = x => x * x;
let squares = [1,2,3].map(square);
console.log(squares) // [1,4,9]
let add = (a,b) => a + b;
add(2,3); // 5
2 args: needs parens, implicit return
let add = (a,b) => { return a + b };
add(2,3); // 5
function body: use {}, explicit return
Arrow functions =>
`arguments` from outer scope
let x = function() {
return () => {
alert(arguments[0]);
};
}
let y = x(5);
y();
uses x’s arguments
template strings
string interpolation!
let foo = 'bar';
console.log(`foo = ${foo}`);
// "foo = bar"
let multiline = `first line
and second line
`);
multiline strings
destructuring assignment
let obj = {
foo: 'bar',
boo: 'baz'
};
let {foo, boo} = obj;
console.log(foo); // 'bar'
console.log(boo); // 'baz'
let colors = ['red', 'green'];
let [color1, color2] = colors;
console.log(color2); // green
for objects
for arrays
destructuring assignment
mixed
let obj = {
foo: 'bar',
colors: ['red', 'green']
}
let {foo, colors: [color1, color2]} = obj;
console.log(foo); // bar
console.log(color2); // green
shorthand object assignment
same property and
variable name
let foo = 'bar';
let obj = {
foo,
boo() {
console.log('baz');
}
}
console.log(obj.foo); // bar
obj.boo(); // baz
function without
“: function”
default function params
function doSomething(timeout, options) {
timeout = timeout || 2000;
options = options || {repeat: true};
var repeat = options.repeat;
setTimeout(function(){
console.log(repeat);
}, timeout);
}
doSomething(0);
// logs 'true' after 2000ms
ES5
default function params
function doSomething(timeout=2000, {repeat}={repeat:true}) {
setTimeout(function(){
console.log(repeat);
}, timeout);
}
doSomething(0);
// logs "true" right away
ES6
function rest params
function sum(first, ...others) {
let sum = first;
for (let i of others) {
sum = sum + i;
}
console.log(sum);
}
sum(1, 2, 3, 4); // 10
others is an array of remaining args
spread operator
function sum2(first, ...others) {
console.log(sum + Math.max(...others));
}
sum2(1, 2, 4, 3); // 5 (=== 1 + 4)
Math.max(…others)
is equivalent to Math.max(2,4,3)
classes
class Person {
constructor() {
this.name = 'Cory';
}
sayHi() {
console.log(this.name);
}
}
let p = new Person();
p.sayHi(); // Cory
extend and super also work as expected
modules
named export
// file a.js
export let x = ‘yes';
export default {
foo: 'bar'
};
// file b.js
import { x } from 'a';
console.log(x); // yes
import stuff from 'a';
console.log(stuff.foo); // bar
named import
default export
default import
Other ES2015 features
• Object.is() — fixes == and ===
• Unicode support
• Promises for async support
• Symbols — a new primitive
• iterators and generators
• Map, Set
• Object.assign() — aka `extend`, `merge` or `mixin`
• String methods — `includes`, `repeat`, `startsWith`
• function.name
• … many more
What’s the status today?
How do I use it?
Babel support
• Many ES2015 (aka ES6) features and syntax
• Some ES2016 (aka ES7) features and syntax
• Some things transpiled directly to ES5
• Some supported via Polyfill
• Some not supported yet (Proxies, in particular)
The JavaScript Future
• Transpiling
• Not just a transitionary thing
• Support matrices
• ES is a living standard
• Venn Diagram of ES2015 / ES2016 / Browser Support
• As target browsers support features your code uses, turn off transpilation of
those features
Cory Forsyth
@bantic
Thank you!
• Babel and Babel REPL
• Using ES6 Today
• ES6 Glossary
• ES6+ Compatibility Table
• ES6 Overview Slides
• ECMA-262 Living Standard on github
• Ecma International
• ES6 Learning
• Aligning Ember With Web Standards
• http://bit.ly/bantic-es6 — these slides
Links

Contenu connexe

Tendances

ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016Manoj Kumar
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.boyney123
 
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]Guillermo Paz
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
Javascript ES6 generators
Javascript ES6 generatorsJavascript ES6 generators
Javascript ES6 generatorsRamesh Nair
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScriptGarth Gilmour
 
Planet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance EnhancementPlanet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance Enhancementup2soul
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6Dmitry Soshnikov
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchainedEduard Tomàs
 
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵Wanbok Choi
 
Metaprogramming and Reflection in Common Lisp
Metaprogramming and Reflection in Common LispMetaprogramming and Reflection in Common Lisp
Metaprogramming and Reflection in Common LispDamien Cassou
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Datagreenwop
 
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftHow to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftGiordano Scalzo
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedSusan Potter
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Susan Potter
 

Tendances (20)

EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.
 
ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]ES6 in Production [JSConfUY2015]
ES6 in Production [JSConfUY2015]
 
JavaScript ES6
JavaScript ES6JavaScript ES6
JavaScript ES6
 
Modern JS with ES6
Modern JS with ES6Modern JS with ES6
Modern JS with ES6
 
ES6: Features + Rails
ES6: Features + RailsES6: Features + Rails
ES6: Features + Rails
 
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
HelsinkiJS meet-up. Dmitry Soshnikov - ECMAScript 6
 
Javascript ES6 generators
Javascript ES6 generatorsJavascript ES6 generators
Javascript ES6 generators
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 
Planet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance EnhancementPlanet-HTML5-Game-Engine Javascript Performance Enhancement
Planet-HTML5-Game-Engine Javascript Performance Enhancement
 
FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6FalsyValues. Dmitry Soshnikov - ECMAScript 6
FalsyValues. Dmitry Soshnikov - ECMAScript 6
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
 
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
[Let'Swift 2019] 실용적인 함수형 프로그래밍 워크샵
 
Metaprogramming and Reflection in Common Lisp
Metaprogramming and Reflection in Common LispMetaprogramming and Reflection in Common Lisp
Metaprogramming and Reflection in Common Lisp
 
Category theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) DataCategory theory, Monads, and Duality in the world of (BIG) Data
Category theory, Monads, and Duality in the world of (BIG) Data
 
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftHow to Clone Flappy Bird in Swift
How to Clone Flappy Bird in Swift
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 

En vedette

ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptWojciech Dzikowski
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6Rob Eisenberg
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You KnewTroy Miles
 
JavaScript 快速複習 2017Q1
JavaScript 快速複習 2017Q1JavaScript 快速複習 2017Q1
JavaScript 快速複習 2017Q1Sheng-Han Su
 
WebApps com Web Components
WebApps com Web ComponentsWebApps com Web Components
WebApps com Web ComponentsBeto Muniz
 
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09Horacio Gonzalez
 
Um salve para evolução! construindo uma nova web com polymer
Um salve para evolução! construindo uma nova web com  polymerUm salve para evolução! construindo uma nova web com  polymer
Um salve para evolução! construindo uma nova web com polymerMarcus Silva
 
Chrome Dev Summit Highlights (NYC GDG Dec 2013)
Chrome Dev Summit Highlights (NYC GDG Dec 2013)Chrome Dev Summit Highlights (NYC GDG Dec 2013)
Chrome Dev Summit Highlights (NYC GDG Dec 2013)Nitya Narasimhan
 
The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015Brandon Belvin
 
Tech talk polymer
Tech talk polymerTech talk polymer
Tech talk polymerYanuar W
 
Polymer Elements: Tudo que você precisa saber para criar a web
Polymer Elements: Tudo que você precisa saber para criar a webPolymer Elements: Tudo que você precisa saber para criar a web
Polymer Elements: Tudo que você precisa saber para criar a webBeto Muniz
 
Apresentação Google I/O Extended Vitória
Apresentação Google I/O Extended VitóriaApresentação Google I/O Extended Vitória
Apresentação Google I/O Extended VitóriaFabiano Monte
 
Material Design - do smartphone ao desktop
Material Design - do smartphone ao desktopMaterial Design - do smartphone ao desktop
Material Design - do smartphone ao desktopHillary Sousa
 
Polymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimePolymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimeJuarez Filho
 

En vedette (20)

ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
The New JavaScript: ES6
The New JavaScript: ES6The New JavaScript: ES6
The New JavaScript: ES6
 
ES6: The Awesome Parts
ES6: The Awesome PartsES6: The Awesome Parts
ES6: The Awesome Parts
 
Lecture 2: ES6 / ES2015 Slide
Lecture 2: ES6 / ES2015 SlideLecture 2: ES6 / ES2015 Slide
Lecture 2: ES6 / ES2015 Slide
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
 
JavaScript 快速複習 2017Q1
JavaScript 快速複習 2017Q1JavaScript 快速複習 2017Q1
JavaScript 快速複習 2017Q1
 
Workshop de Web Components
Workshop de Web ComponentsWorkshop de Web Components
Workshop de Web Components
 
Material design
Material designMaterial design
Material design
 
WebApps com Web Components
WebApps com Web ComponentsWebApps com Web Components
WebApps com Web Components
 
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
Battle of Frameworks: Polymer - Meetup Paris Web Components - 2016-09
 
Um salve para evolução! construindo uma nova web com polymer
Um salve para evolução! construindo uma nova web com  polymerUm salve para evolução! construindo uma nova web com  polymer
Um salve para evolução! construindo uma nova web com polymer
 
Chrome Dev Summit Highlights (NYC GDG Dec 2013)
Chrome Dev Summit Highlights (NYC GDG Dec 2013)Chrome Dev Summit Highlights (NYC GDG Dec 2013)
Chrome Dev Summit Highlights (NYC GDG Dec 2013)
 
The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015The Beautiful Simplicity of ES2015
The Beautiful Simplicity of ES2015
 
Tech talk polymer
Tech talk polymerTech talk polymer
Tech talk polymer
 
Polymer Starter Kit
Polymer Starter KitPolymer Starter Kit
Polymer Starter Kit
 
Polymer Elements: Tudo que você precisa saber para criar a web
Polymer Elements: Tudo que você precisa saber para criar a webPolymer Elements: Tudo que você precisa saber para criar a web
Polymer Elements: Tudo que você precisa saber para criar a web
 
Apresentação Google I/O Extended Vitória
Apresentação Google I/O Extended VitóriaApresentação Google I/O Extended Vitória
Apresentação Google I/O Extended Vitória
 
Web components
Web componentsWeb components
Web components
 
Material Design - do smartphone ao desktop
Material Design - do smartphone ao desktopMaterial Design - do smartphone ao desktop
Material Design - do smartphone ao desktop
 
Polymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in RealtimePolymer and Firebase: Componentizing the Web in Realtime
Polymer and Firebase: Componentizing the Web in Realtime
 

Similaire à Explaining ES6: JavaScript History and What is to Come

Introduction to ES6 with Tommy Cresine
Introduction to ES6 with Tommy CresineIntroduction to ES6 with Tommy Cresine
Introduction to ES6 with Tommy CresineMovel
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervosoLuis Vendrame
 
ESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowKrzysztof Szafranek
 
ECMAScript 6 new features
ECMAScript 6 new featuresECMAScript 6 new features
ECMAScript 6 new featuresGephenSG
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almostQuinton Sheppard
 
What's New in ES6 for Web Devs
What's New in ES6 for Web DevsWhat's New in ES6 for Web Devs
What's New in ES6 for Web DevsRami Sayar
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)Eduard Tomàs
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016Codemotion
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6WebF
 
Fitc whats new in es6 for web devs
Fitc   whats new in es6 for web devsFitc   whats new in es6 for web devs
Fitc whats new in es6 for web devsFITC
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015qmmr
 
Ignite es6
Ignite es6Ignite es6
Ignite es6jstack
 

Similaire à Explaining ES6: JavaScript History and What is to Come (20)

Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
 
Introduction to ES6 with Tommy Cresine
Introduction to ES6 with Tommy CresineIntroduction to ES6 with Tommy Cresine
Introduction to ES6 with Tommy Cresine
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervoso
 
Javascript
JavascriptJavascript
Javascript
 
ESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. Now
 
ECMAScript 6 new features
ECMAScript 6 new featuresECMAScript 6 new features
ECMAScript 6 new features
 
Awesomeness of JavaScript…almost
Awesomeness of JavaScript…almostAwesomeness of JavaScript…almost
Awesomeness of JavaScript…almost
 
ECMAScript 2015
ECMAScript 2015ECMAScript 2015
ECMAScript 2015
 
Es6 hackathon
Es6 hackathonEs6 hackathon
Es6 hackathon
 
What's New in ES6 for Web Devs
What's New in ES6 for Web DevsWhat's New in ES6 for Web Devs
What's New in ES6 for Web Devs
 
JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)JavaScript in 2016 (Codemotion Rome)
JavaScript in 2016 (Codemotion Rome)
 
JavaScript in 2016
JavaScript in 2016JavaScript in 2016
JavaScript in 2016
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
Fitc whats new in es6 for web devs
Fitc   whats new in es6 for web devsFitc   whats new in es6 for web devs
Fitc whats new in es6 for web devs
 
AkJS Meetup - ES6++
AkJS Meetup -  ES6++AkJS Meetup -  ES6++
AkJS Meetup - ES6++
 
Rust-lang
Rust-langRust-lang
Rust-lang
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
ECMAScript2015
ECMAScript2015ECMAScript2015
ECMAScript2015
 
Ignite es6
Ignite es6Ignite es6
Ignite es6
 

Plus de Cory Forsyth

EmberFest Mobiledoc Demo Lightning Talk
EmberFest Mobiledoc Demo Lightning TalkEmberFest Mobiledoc Demo Lightning Talk
EmberFest Mobiledoc Demo Lightning TalkCory Forsyth
 
Making ember-wormhole work with Fastboot
Making ember-wormhole work with FastbootMaking ember-wormhole work with Fastboot
Making ember-wormhole work with FastbootCory Forsyth
 
Chrome Extensions at Manhattan JS
Chrome Extensions at Manhattan JSChrome Extensions at Manhattan JS
Chrome Extensions at Manhattan JSCory Forsyth
 
OAuth 2.0 Misconceptions
OAuth 2.0 MisconceptionsOAuth 2.0 Misconceptions
OAuth 2.0 MisconceptionsCory Forsyth
 
Ember Authentication and Authorization with Torii
Ember Authentication and Authorization with ToriiEmber Authentication and Authorization with Torii
Ember Authentication and Authorization with ToriiCory Forsyth
 
HAL APIs and Ember Data
HAL APIs and Ember DataHAL APIs and Ember Data
HAL APIs and Ember DataCory Forsyth
 
Ember testing internals with ember cli
Ember testing internals with ember cliEmber testing internals with ember cli
Ember testing internals with ember cliCory Forsyth
 
Stackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for EverybodyStackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for EverybodyCory Forsyth
 
Microsoft tech talk march 28 2014
Microsoft tech talk march 28 2014Microsoft tech talk march 28 2014
Microsoft tech talk march 28 2014Cory Forsyth
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0Cory Forsyth
 
Torii: Ember.js Authentication Library
Torii: Ember.js Authentication LibraryTorii: Ember.js Authentication Library
Torii: Ember.js Authentication LibraryCory Forsyth
 
APIs: Internet for Robots
APIs: Internet for RobotsAPIs: Internet for Robots
APIs: Internet for RobotsCory Forsyth
 

Plus de Cory Forsyth (12)

EmberFest Mobiledoc Demo Lightning Talk
EmberFest Mobiledoc Demo Lightning TalkEmberFest Mobiledoc Demo Lightning Talk
EmberFest Mobiledoc Demo Lightning Talk
 
Making ember-wormhole work with Fastboot
Making ember-wormhole work with FastbootMaking ember-wormhole work with Fastboot
Making ember-wormhole work with Fastboot
 
Chrome Extensions at Manhattan JS
Chrome Extensions at Manhattan JSChrome Extensions at Manhattan JS
Chrome Extensions at Manhattan JS
 
OAuth 2.0 Misconceptions
OAuth 2.0 MisconceptionsOAuth 2.0 Misconceptions
OAuth 2.0 Misconceptions
 
Ember Authentication and Authorization with Torii
Ember Authentication and Authorization with ToriiEmber Authentication and Authorization with Torii
Ember Authentication and Authorization with Torii
 
HAL APIs and Ember Data
HAL APIs and Ember DataHAL APIs and Ember Data
HAL APIs and Ember Data
 
Ember testing internals with ember cli
Ember testing internals with ember cliEmber testing internals with ember cli
Ember testing internals with ember cli
 
Stackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for EverybodyStackup New Languages Talk: Ember is for Everybody
Stackup New Languages Talk: Ember is for Everybody
 
Microsoft tech talk march 28 2014
Microsoft tech talk march 28 2014Microsoft tech talk march 28 2014
Microsoft tech talk march 28 2014
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
 
Torii: Ember.js Authentication Library
Torii: Ember.js Authentication LibraryTorii: Ember.js Authentication Library
Torii: Ember.js Authentication Library
 
APIs: Internet for Robots
APIs: Internet for RobotsAPIs: Internet for Robots
APIs: Internet for Robots
 

Dernier

'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 

Dernier (20)

'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 

Explaining ES6: JavaScript History and What is to Come

  • 4. JavaScript is not a Language • JavaScript is an implementation of a language • ActionScript was another implementation • The name of the language is: ECMAScript • JavaScript : ECMAScript :: Rubinius/JRuby : Ruby
  • 5. JavaScript History • Invented at Netscape by Brendan Eich • Mocha -> LiveScript -> JavaScript • 1996 -> Standardization taken by Ecma • Renamed -> ECMAScript (trademark reasons)
  • 6. ECMAScript • What is Ecma? • “Ecma International is an industry association … dedicated to the standardization of Information and Communication Technology” • Its website slogan is: “Standards@Internet Speed”
  • 7.
  • 9. Ecma Org Chart • TC = Technical Committee • TC39 = Technical Committee tasked with ECMAScript ® • TC39 Official Scope: “Standardization of the general purpose, cross platform, vendor-neutral programming language ECMAScript.” • Ecma = European Computer Manufacturers Association
  • 10. ECMAScript • 1997: ECMA-262: Language Standard • On github (now): tc39/ecma262 • 1998 ES2 • 1999 ES3
  • 13. ECMAScript • 2000: ES4 • 2005: ES4 • Mozilla and Macromedia • Big changes, major leap from ES5
  • 14. ECMAScript • 2000: ES4 • 2005: ES4 • Mozilla and Macromedia • Big changes, major leap from ES5 • Divisive, Yahoo & Microsoft opposed
  • 15. ECMAScript • 2000: ES4 • 2005: ES4 • Mozilla and Macromedia • Big changes, major leap from ES5 • Divisive, Yahoo & Microsoft opposed
  • 16. ES5 • 2009 in Oslo • “Modern” JavaScript • Originally v3.1 (incremental change) • “Harmony”
  • 17. ES6 • Will be released in 2015 • After this, versions will be released yearly: • ES2015 • ES2016 • …
  • 19. ES2015 • Syntax Changes • New features • Fixes • Superset of ES5
  • 20. if (true) { var x = 'yes'; } console.log(x); // 'yes' if (true) { let x = 'yes'; } console.log(x); // ReferenceError var is hoisted let is block scope `let` there be light scope
  • 21. hoisting function() { console.log(x); // undefined var x = 'foo'; console.log(x); // ‘foo’ }
  • 22. hoisting function() { var x; console.log(x); // undefined x = 'foo'; console.log(x); // ‘foo’ }
  • 23. `let` : temporal dead zone function() { console.log(x); // ReferenceError // TDZ let x = 'foo'; console.log(x); // ‘foo’ }
  • 24. `let` there be sanity let funcs = []; for (var i=0; i < 5; i++) { funcs.push(function() { alert(i); }); } funcs[0]();
  • 25. `let` there be sanity let funcs = []; for (let i=0; i < 5; i++) { funcs.push(function() { alert(i); }); } funcs[0](); a new i for each turn of the loop
  • 26. `const` const x = 'foo'; x = 'bar'; // error const x = { foo: 'bar' }; x.foo = 'baz'; // ok (!) can modify properties of a const cannot reassign const use Object.freeze, Object.seal to prevent changes to an object
  • 27. Arrow functions => var x = function() {} let x = () => {} • Has own scope • Has `arguments` • No implicit return • “lexical” scope • No `arguments` • implicit return* • *sometimes
  • 28. Arrow functions => this.x = 'yes'; let y = () => { "use strict"; console.log(this.x); }; y(); // 'yes' this.x = 'yes'; var y = function(){ "use strict"; console.log(this.x); }; y(); // TypeError… `this` is undefined `this` from outer scope No need for var that = this, `bind` with arrow functions
  • 29. Arrow functions => 1 arg: no parens, implicit return let square = x => x * x; let squares = [1,2,3].map(square); console.log(squares) // [1,4,9]
  • 30. Arrow functions => 1 arg: no parens, implicit return let square = x => x * x; let squares = [1,2,3].map(square); console.log(squares) // [1,4,9] let add = (a,b) => a + b; add(2,3); // 5 2 args: needs parens, implicit return
  • 31. Arrow functions => 1 arg: no parens, implicit return let square = x => x * x; let squares = [1,2,3].map(square); console.log(squares) // [1,4,9] let add = (a,b) => a + b; add(2,3); // 5 2 args: needs parens, implicit return let add = (a,b) => { return a + b }; add(2,3); // 5 function body: use {}, explicit return
  • 32. Arrow functions => `arguments` from outer scope let x = function() { return () => { alert(arguments[0]); }; } let y = x(5); y(); uses x’s arguments
  • 33. template strings string interpolation! let foo = 'bar'; console.log(`foo = ${foo}`); // "foo = bar" let multiline = `first line and second line `); multiline strings
  • 34. destructuring assignment let obj = { foo: 'bar', boo: 'baz' }; let {foo, boo} = obj; console.log(foo); // 'bar' console.log(boo); // 'baz' let colors = ['red', 'green']; let [color1, color2] = colors; console.log(color2); // green for objects for arrays
  • 35. destructuring assignment mixed let obj = { foo: 'bar', colors: ['red', 'green'] } let {foo, colors: [color1, color2]} = obj; console.log(foo); // bar console.log(color2); // green
  • 36. shorthand object assignment same property and variable name let foo = 'bar'; let obj = { foo, boo() { console.log('baz'); } } console.log(obj.foo); // bar obj.boo(); // baz function without “: function”
  • 37. default function params function doSomething(timeout, options) { timeout = timeout || 2000; options = options || {repeat: true}; var repeat = options.repeat; setTimeout(function(){ console.log(repeat); }, timeout); } doSomething(0); // logs 'true' after 2000ms ES5
  • 38. default function params function doSomething(timeout=2000, {repeat}={repeat:true}) { setTimeout(function(){ console.log(repeat); }, timeout); } doSomething(0); // logs "true" right away ES6
  • 39. function rest params function sum(first, ...others) { let sum = first; for (let i of others) { sum = sum + i; } console.log(sum); } sum(1, 2, 3, 4); // 10 others is an array of remaining args
  • 40. spread operator function sum2(first, ...others) { console.log(sum + Math.max(...others)); } sum2(1, 2, 4, 3); // 5 (=== 1 + 4) Math.max(…others) is equivalent to Math.max(2,4,3)
  • 41. classes class Person { constructor() { this.name = 'Cory'; } sayHi() { console.log(this.name); } } let p = new Person(); p.sayHi(); // Cory extend and super also work as expected
  • 42. modules named export // file a.js export let x = ‘yes'; export default { foo: 'bar' }; // file b.js import { x } from 'a'; console.log(x); // yes import stuff from 'a'; console.log(stuff.foo); // bar named import default export default import
  • 43. Other ES2015 features • Object.is() — fixes == and === • Unicode support • Promises for async support • Symbols — a new primitive • iterators and generators • Map, Set • Object.assign() — aka `extend`, `merge` or `mixin` • String methods — `includes`, `repeat`, `startsWith` • function.name • … many more
  • 45.
  • 46. How do I use it?
  • 47.
  • 48. Babel support • Many ES2015 (aka ES6) features and syntax • Some ES2016 (aka ES7) features and syntax • Some things transpiled directly to ES5 • Some supported via Polyfill • Some not supported yet (Proxies, in particular)
  • 49. The JavaScript Future • Transpiling • Not just a transitionary thing • Support matrices • ES is a living standard • Venn Diagram of ES2015 / ES2016 / Browser Support • As target browsers support features your code uses, turn off transpilation of those features
  • 50. Cory Forsyth @bantic Thank you! • Babel and Babel REPL • Using ES6 Today • ES6 Glossary • ES6+ Compatibility Table • ES6 Overview Slides • ECMA-262 Living Standard on github • Ecma International • ES6 Learning • Aligning Ember With Web Standards • http://bit.ly/bantic-es6 — these slides Links