Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ecmascript 2015
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Benjamin
July 03, 2015
Programming
59
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ecmascript 2015
Benjamin
July 03, 2015
More Decks by Benjamin
See All by Benjamin
Intégrer Cordova dans une appli native
benjmichel
0
91
Other Decks in Programming
See All in Programming
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
330
気圧・高度・GPSを記録&可視化するアプリ「Koudo」を作った話
hjmkth
1
240
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
310
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
240
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
480
3Dシーンの圧縮
fadis
1
770
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.6k
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
2
670
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
2
640
ふつうのFeature Flag実践入門
irof
7
3.9k
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
4.2k
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1033
470k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
320
Believing is Seeing
oripsolob
1
140
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Music & Morning Musume
bryan
47
7.2k
Between Models and Reality
mayunak
4
340
So, you think you're a good person
axbom
PRO
2
2.1k
Statistics for Hackers
jakevdp
799
230k
Accessibility Awareness
sabderemane
1
140
Become a Pro
speakerdeck
PRO
31
6k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
590
Transcript
ECMAScript 2015 Benjamin MICHEL 03/07/2015
What is ECMASript ? • a scripting language • standardized
by Ecma International • several well-known implementations: ◦ JavaScript ◦ JScript ◦ ActionScript
History of ES • First edition 1997 • ES 3
in 1999 • ES 4 never released : too ambitious • ES 5 in 2009 • ES 6/2015 also called Harmony • ES 7/2016
ES2015 features
Promises var promise = new Promise(function(resolve, reject) { // some
code }); promise.then(successCb, errorCb); promise.catch(errorCb); Promise.all([promise1, promise2]);
Class class MyClass extends MyParentClass { constructor (param1, param2) {
super(param1, param2); // some code } myMethod1(param) { // some code } static myMethod2(param) { // some code } }
Generator function* testYield(){ var index = 0; while(index < 3){
yield index++; } } var gen = testYield(); console.log(gen.next().value); // 0 console.log(gen.next().value); // 1 console.log(gen.next().value); // 2 console.log(gen.next().value); // undefined
Let - Const function varTest() { var x = 31;
if (true) { var x = 71; console.log(x); // 71 } console.log(x); // 71 } function letTest() { let x = 31; if (true) { let x = 71; console.log(x); // 71 } console.log(x); // 31 } const myConstant = 42; myConstant = 12; // Error const myConstant = 3; // Error
Arrow ([param] [, param]) => { instructions } param =>
expression // implicit return var square = (x) => x*x;
Arrow - Bind this lexically ES5: var myObject = {
var myString = ‘Hello’; var myArray = [‘a’, ‘b’, ‘c’]; var myMethod = function () { var self = this; this.myArray.forEach(function(element){ console.log(self.myString + element); }) } } ES2015: var myObject = { var myString = ‘Hello’; var myArray = [‘a’, ‘b’, ‘c’]; var myMethod = function () { this.myArray.forEach((element) => console.log(this.myString + element); }) } }
Destructuring var anArray = [1,2,3]; var [one, two, three] =
anArray; var [foo, [[bar], baz]] = [1, [[2], 3]]; var anObject = {prop1: ‘abc’}; var {prop1: myProp1} = anObject;
String template console.log(`first line second line`); var a = 2;
var b = 3; console.log(`the sum of a and b is ${a+b}`);
For .. of var myArray = [‘a’, ‘b’, ’c’]; for(
let myElement of myArray) { console.log(myElement); }
Modules // lib.js export square = (x) => x*x; //
main.js import {square} from lib; console.log(square(4)); NB: a lot of variation of ‘import’ syntax exist to please both AMD and Common.js users
Map set let mySet = new Set([1,2,2,2,2,2,2]); mySet.add(3); console.log(mySet.size); //
3 console.log(mySet.has(2); // true mySet.delete(2); console.log(mySet.has(2); // false
Current support
ES 2015
ES 2016
Links • http://kangax.github.io/compat-table/es6/ • http://es6katas.org/ • https://babeljs.io/docs/learn-es2015/