SlideShare a Scribd company logo
ECMASCRIPT 2017
彭洪伟
Max Peng - hwpeng@thoughtworks.com
1
2
StackOverflow(Tags)
Github(PRs)
Java is to JavaScript what Car is to Carpet.
AGENDA
3
Background
ECMAScript 2016(AKA.ES 7)
ECMAScript 2017(AKA.ES 8)
BACKGROUND
4
POSITION IN RADAR
5
●ASSESS
Worth of exploring the goal of
understanding how it will affect
your enterprise.
ECMA & TC 39
European Computer Manufacturers Association
Technical Committee 39
TC 39 process
6
TC 39 PROCESS
7
Stage Purpose Post-Acceptance
Changes Expected
Implementation
Types Expected
0 - Strawman • Allow input into the specification N/A N/A
1 - Proposal
• Make the case for the addition
• Describe the shape of a solution
• Identify potential challenges
Major Polyfills / demos
2 - Draft • Precisely describe the syntax and
semantics using formal spec language Incremental Experimental
3 - Candidate • Indicate that further refinement will require
feedback from implementations and users
Limited: only those
deemed critical based on
implementation experience
Spec compliant
4 - Finished • Indicate that the addition is ready for
inclusion in the formal ECMAScript standard None Shipping
https://tc39.github.io/process-document/
ECMASCRIPT 2016
8
FEATURES
Array.prototype.includes
Exponentiation operator (**)
9
EXAMPLES - INCLUDES AND EXPONENTIATION
10
Exponentiation
let number = 3;
console.log(Math.pow(3, 2));
// 9
number **= 2;
console.log(number);
// 9
Includes
const arr = [NaN, 1];
console.log(arr.indexOf(NaN));
// -1
console.log(arr.includes(NaN));
// true
11
Why ES2016(ES7) is so small?
http://2ality.com/2016/01/ecmascript-2016.html
WHY ES2016(ES7) IS SO SMALL?
ECMASCRIPT 2017
12
MAJOR FEATURES
Async functions
Shared memory and atomics
13
EXAMPLE - ASYNC FUNCTIONS
14
async function asyncFunc() {
const result1 = await otherAsyncFunc1();
console.log(result1);
const result2 = await otherAsyncFunc2();
console.log(result2);
}
function otherAsyncFunc1() {
//return a promise
}
function otherAsyncFunc2() {
//return a promise
}
function asyncFunc() {
return otherAsyncFunc1()
.then(result1 => {
console.log(result1);
return otherAsyncFunc2();
})
.then(result2 => {
console.log(result2);
});
}
function otherAsyncFunc1() {
//return a promise
}
function otherAsyncFunc2() {
//return a promise
}
1. Async functions always return Promises
2. The operator await is only allowed inside async functions
EXAMPLE - SHARED MEMORY
15
const worker = new Worker('worker.js');
const sharedBuffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 10);
const sharedArray = new Int32Array(sharedBuffer);
for (let i = 0; i < 10; i++) sharedArray[i] = i && sharedArray[i - 1] + 2
worker.postMessage(sharedBuffer);
setTimeout(() => {
console.log('[MAIN] Change triggered.');
sharedArray[0] = 1337
}, 5000);
main.js
self.addEventListener('message', (message) => {
const sharedArray = new Int32Array(message.data);
console.log('[WORKER] First value is: ' + sharedArray[0]);
setTimeout(() => {
console.log('[WORKER] First value is now: ' + sharedArray[0])
}, 10000)
});
worker.js
[WORKER] First value is: 0
[MAIN] Change triggered.
[WORKER] First value is now: 1337
EXAMPLE - ATOMICS
16
self.addEventListener('message', (message) => {
const sharedArray = new Int32Array(message.data);
console.log('[WORKER] First value is: ' + sharedArray[0]);
while (sharedArray[0] === 0);
console.log('[WORKER] Changed! New value is ' + sharedArray[0])
});
const tmp = sharedArray[0];
while (tmp === 123);
self.addEventListener('message', (message) => {
const sharedArray = new Int32Array(message.data);
console.log('[WORKER] First value is: ' + sharedArray[0]);
while (Atomics.load(sharedArray, 0) === 0);
console.log('[WORKER] Changed! New value is ' + sharedArray[0])
});
After compiler optimization
MINOR FEATURES
Object.entries() and Object.values()
New string methods: padStart and padEnd
Object.getOwnPropertyDescriptors()
Trailing commas in function parameter lists and calls
17
hwpeng@thoughtworks.com
THANK YOU
REFERENCES
19
http://ecma-international.org/memento/TC39.htm
https://www.ecma-international.org/memento/history.htm
https://github.com/tc39
http://exploringjs.com/es2016-es2017/index.html
https://www.quora.com/What-is-the-difference-between-concurrency-and-
parallelism/answer/Vicky-Katara?srid=umS5Y
http://javascript.ruanyifeng.com/introduction/history.html
https://tc39.github.io/process-document/
http://2ality.com/2016/01/ecmascript-2016.html
http://lucasfcosta.com/2017/04/30/JavaScript-From-Workers-to-Shared-
Memory.html

More Related Content

PDF
Debugging and Profiling C++ Template Metaprograms
Platonov Sergey
 
PDF
C# p7
Renas Rekany
 
PPT
Removal Of Recursion
Richa Sharma
 
PDF
Categories for the Working C++ Programmer
Platonov Sergey
 
PDF
P3
lksoo
 
PPTX
Annotation processor and compiler plugin
Oleksandr Radchykov
 
PDF
Project_Euler_No_104_Pandigital_Fibonacci_ends
? ?
 
PPT
Fp201 unit2 1
rohassanie
 
Debugging and Profiling C++ Template Metaprograms
Platonov Sergey
 
Removal Of Recursion
Richa Sharma
 
Categories for the Working C++ Programmer
Platonov Sergey
 
P3
lksoo
 
Annotation processor and compiler plugin
Oleksandr Radchykov
 
Project_Euler_No_104_Pandigital_Fibonacci_ends
? ?
 
Fp201 unit2 1
rohassanie
 

What's hot (19)

PDF
General structure of c++
Ajay Chimmani
 
PPT
Loops (1)
esmail said
 
PPT
Concept of c
Rohan Gajre
 
PPTX
c++ programming Unit 2 basic structure of a c++ program
AAKASH KUMAR
 
PDF
Do while loop
BU
 
PPTX
C++ questions
devimithra
 
PDF
Golang dot-testing-lite
Richárd Kovács
 
PPTX
Finagle Lightning Talk JPR 2014
Chris Phelps
 
PPTX
Loop c++
Mood Mood
 
PDF
Java day 2016.pptx
Oleksandr Radchykov
 
PPT
Os2
issbp
 
PDF
A tutorial on C++ Programming
Prof. Erwin Globio
 
DOCX
Check the output of the following code then recode it to eliminate fu
licservernoida
 
DOCX
Assignement of programming & problem solving(3)a.z
Syed Umair
 
PPT
OS Process Synchronization, semaphore and Monitors
sgpraju
 
PDF
Implement ERC20 on TestRPC
KC Tam
 
PPT
C++ control loops
pratikborsadiya
 
PPT
Control Statements, Array, Pointer, Structures
indra Kishor
 
General structure of c++
Ajay Chimmani
 
Loops (1)
esmail said
 
Concept of c
Rohan Gajre
 
c++ programming Unit 2 basic structure of a c++ program
AAKASH KUMAR
 
Do while loop
BU
 
C++ questions
devimithra
 
Golang dot-testing-lite
Richárd Kovács
 
Finagle Lightning Talk JPR 2014
Chris Phelps
 
Loop c++
Mood Mood
 
Java day 2016.pptx
Oleksandr Radchykov
 
Os2
issbp
 
A tutorial on C++ Programming
Prof. Erwin Globio
 
Check the output of the following code then recode it to eliminate fu
licservernoida
 
Assignement of programming & problem solving(3)a.z
Syed Umair
 
OS Process Synchronization, semaphore and Monitors
sgpraju
 
Implement ERC20 on TestRPC
KC Tam
 
C++ control loops
pratikborsadiya
 
Control Statements, Array, Pointer, Structures
indra Kishor
 
Ad

Similar to ECMAScript 2017 (20)

PDF
JavaScript Editions ES7, ES8 and ES9 vs V8
Rafael Casuso Romate
 
PPTX
2015 05 27 JSConf - concurrency and parallelism final
Naveed Ihsanullah
 
PPTX
MiamiJS - The Future of JavaScript
Caridy Patino
 
PDF
JavaScript promise
eslam_me
 
PPTX
Async discussion 9_29_15
Cheryl Yaeger
 
PDF
What's New in JavaScript
Dan Cohn
 
PPTX
Ecma script
MOHIT KUMAR
 
PPTX
FRONTEND BOOTCAMP Session 2.pptx
Ehtesham46
 
PDF
Intro to Asynchronous Javascript
Garrett Welson
 
PDF
The evolution of asynchronous javascript
Alessandro Cinelli (cirpo)
 
PDF
JavaScript Futures—ES2017 and Beyond
Jeff Strauss
 
PPTX
Java Script Promise
Alok Guha
 
PDF
Asynchronous development in JavaScript
Amitai Barnea
 
PDF
ECMA Script
NodeXperts
 
PDF
Synchronously call your async functions
Igalia
 
PDF
JavaScript for real men
Ivano Malavolta
 
PDF
JavaScript, un langage plein de promesses
rfelden
 
PDF
The evolution of asynchronous JavaScript
Alessandro Cinelli (cirpo)
 
PDF
Asynchronous Programming. Talk from ESUG2024
ESUG
 
PDF
Nobody asks "How is JavaScript?"
Igalia
 
JavaScript Editions ES7, ES8 and ES9 vs V8
Rafael Casuso Romate
 
2015 05 27 JSConf - concurrency and parallelism final
Naveed Ihsanullah
 
MiamiJS - The Future of JavaScript
Caridy Patino
 
JavaScript promise
eslam_me
 
Async discussion 9_29_15
Cheryl Yaeger
 
What's New in JavaScript
Dan Cohn
 
Ecma script
MOHIT KUMAR
 
FRONTEND BOOTCAMP Session 2.pptx
Ehtesham46
 
Intro to Asynchronous Javascript
Garrett Welson
 
The evolution of asynchronous javascript
Alessandro Cinelli (cirpo)
 
JavaScript Futures—ES2017 and Beyond
Jeff Strauss
 
Java Script Promise
Alok Guha
 
Asynchronous development in JavaScript
Amitai Barnea
 
ECMA Script
NodeXperts
 
Synchronously call your async functions
Igalia
 
JavaScript for real men
Ivano Malavolta
 
JavaScript, un langage plein de promesses
rfelden
 
The evolution of asynchronous JavaScript
Alessandro Cinelli (cirpo)
 
Asynchronous Programming. Talk from ESUG2024
ESUG
 
Nobody asks "How is JavaScript?"
Igalia
 
Ad

Recently uploaded (20)

PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PDF
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PDF
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PDF
Immersive experiences: what Pharo users do!
ESUG
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PPTX
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
PDF
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
PDF
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 
Activate_Methodology_Summary presentatio
annapureddyn
 
Exploring AI Agents in Process Industries
amoreira6
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
Generating Union types w/ Static Analysis
K. Matthew Dupree
 
Presentation about variables and constant.pptx
kr2589474
 
lesson-2-rules-of-netiquette.pdf.bshhsjdj
jasmenrojas249
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
Immersive experiences: what Pharo users do!
ESUG
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
ConcordeApp: Engineering Global Impact & Unlocking Billions in Event ROI with AI
chastechaste14
 
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
New Download MiniTool Partition Wizard Crack Latest Version 2025
imang66g
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
WatchTraderHub - Watch Dealer software with inventory management and multi-ch...
WatchDealer Pavel
 

ECMAScript 2017