SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
ES7 & ES8
vs
@Rafael_Casuso
A B O U T M E
•CTO @StayApp
•CEO @SnowStormIO
•Organizer @BotDevMad &
@VueJSMadrid
•Software Engineer with +10 years
of experience leading teams and
developing.
•Software Architect looking for
revolutionary ways to change the
world.
A
BRIEF
SETTING
+ INTRODUCTION
JAVASCRIPT VERSIONS
JAVASCRIPT (December 4th 1995) Netscape and Sun press release
ECMAScript Standard Editions:
ES1 (June 1997) Object-based, Scripting, Relaxed syntax, Prototypes
ES2 (June 1998) Editorial changes for ISO 16262
ES3 (December 1999) Regexps, Try/Catch, Do-While, String methods
ES5 (December 2009) Strict mode, JSON, .bind, Object mts, Array mts
ES5.1 (June 2011) Editorial changes for ISO 16262:2011
ES6 (June 2015) Classes, Modules, Arrow Fs, Generators, Const/Let,

Destructuring, Template Literals, Promise, Proxy, Symbol, Reflect
ES7 (June 2016) Exponentiation operator (**) and Array Includes
ES8 (June 2017) Async Fs, Shared Memory & Atomics
JAVASCRIPT ENGINES
V8 (Chrome V8) by Google
Used in Chromium/Chrome & NodeJS
SPIDERMONKEY by Mozilla Foundation
Used in Gecko/Mozilla Firefox & SpiderNode
CHAKRACORE, by Microsoft
Used in Edge & Node ChakraCore
JAVASCRIPTCORE by Apple
RHINO
Written in Java
HOW
DOES
A RELEASE
WORK?
+ INTRODUCTION
TECHNICAL COMMITEES
TC39
Its members are companies
Operates by consensus
Evolves the standard
Yearly edition using TC39
process
TSC (Technical Steering Committee)
Key contributors with technical
expertise and commitment
Frequent meetings
Chooses Collaborators (300+)
Define Working Groups over
Specific Areas
RELEASE PROCESS
TC39 PROCESS
STAGE 0: STRAWMAN Submitted ideas by TC39 member or contributor
STAGE 1: PROPOSAL TC39 member responsible (Champion). Problem
described in prose, solution via examples, API. Obstacles identification.
STAGE 2: DRAFT First version of eventual inclusion. Formal description of
syntax and semantics. Two experimental implementations needed.
STAGE 3: CANDIDATE Feedback stage. Designated reviewer and TC39
editor must sign-off. Two spec-compliant implementations.
STAGE 4: FINISHED Ready for standard. Test262 unit tests for the feature.
Two implementations that pass tests. TC39 editor’s approval.
STANDARD EDITION Each June and ongoing DRAFT with Stage 4 features.
ES7 Edition
(2016)
+ OVERVIEW
ARRAY INCLUDES
Array.prototype.includes(searchElement[, fromIndex]) // => Boolean
WHY
array.indexOf(el) !== -1 || array.indexOf(el) >= 0
It does not work with NaN
Not explicit syntax
EXAMPLES
assert([1, 2, 3].includes(2) === true);
assert([1, 2, 3].includes(4) === false);
assert([1, 2, NaN].includes(NaN) === true);
assert(["a", "b", "c"].includes("a") === true);
assert(["a", "b", "c"].includes("a", 1) === false);
EXPONENTIATION OPERATOR
x ** y // => Math.pow(x, y)
WHY
Math.pow(x, y)
More succint syntax
EXAMPLES
let squared = 3 ** 2; // 9
let num = 3;
num **= 3; // 9
ES8 Edition
(2017)
+ OVERVIEW
ASYNC FUNCTIONS
async function () {} async () => {} //=> Promise
WHY
Sequential much more succinct way to deal with Asynchrony
Better understandable than callbacks (no jumps) and mere Promises
Basic implementation
async function asyncFunc() { return 123 };
asyncFunc().then( x => console.log(x) ); //=> 123
async function asyncFunc() { throw new Error(‘Problem’) };
asyncFunc().catch( err => console.log(err) ); //=> Error: Problem
ASYNC FUNCTIONS: AWAIT OPERATOR
async function asyncFunc() {
const result1 = await otherAsyncFunc1(); //Waits for Promise1 to settle
console.log(result1);
const result2 = await otherAsyncFunc2(); //Waits for Promise2 to settle
console.log(result2);
try { await otherAsyncFunc3() } catch(e) { //Handles err }
}
If Promise is resolved await returns its value
If it is rejected it throws an exception (so Try/Catch is encouraged)
If operand is not a Promise it converts it to a resolved one
Don’t forget it. It has use case even if async function does not return.
You don’t need await if you “fire and forget”
Use Promise.all (parallel) instead of multiple await (sequential) whenever
possible
ASYNC FUNCTIONS: EXECUTION
1) Async function is started synchronously. Its return Promise is created.
2) Its body is executed. It ends permanently via return (resolves Promise with
value) or throw (rejects Promise with error). It ends temporarily via await
(and resumed later).
3) Its Promise is returned. Notification of Promise resolution happens
asynchronously, so .then or .catch will always be executed after.
async function asyncFunc() {
console.log(‘1’);
return ‘3’;
}
asyncFunc().then( x => console.log(x);
console.log(‘2’);
//1
//2
//3
PARALLELISM & CONCURRENCY
Parallelism (parallel vs serial): Execute multiple tasks simultaneously
Data Parallelism: Same code is executed several times in parallel through
instances on different elements of same datset (Ex: MapReduce)
Task Parallelism: Different code is executed in parallel (Ex: Web Workers)
Concurrency (concurrent vs sequential): Execute several tasks during
overlapping periods of time
Web Workers brought Task Parallelism to usually single-thread JavaScript
They hay a dedicated global scope
Communication between workers and main thread by messaging system
They can communicate cloned data structures
Transferable objects are cleared from sender and owned by receiver
SHARED ARRAY BUFFER
Primitive building-block for high-level concurrency abstractions
Share the bytes of SharedArrayBuffer between multiple workers and the main
thread
You can share data between workers more quickly
Coordination between workers becomes simpler and faster
Currently only Array of Integers can be shared
// main.js
const worker = new Worker('worker.js');
// To be shared
const sharedBuffer = new SharedArrayBuffer(10 *
Int32Array.BYTES_PER_ELEMENT); // 10 elements
// Share sharedBuffer with the worker
worker.postMessage({sharedBuffer}); // clone
// worker.js
self.addEventListener('message',
function (event) {
const {sharedBuffer} = event.data;
const sharedArray = new
Int32Array(sharedBuffer);
// ···
});
ATOMICS
Global variable to synchronize the activity of multiple workers using same
SharedArrayBuffer
Synchronization:
// main.js
console.log('notifying...');
Atomics.store(sharedArray, 0, 123);
// worker.js
while (Atomics.load(sharedArray, 0) !== 123) ;
console.log('notified');
Waiting:
Atomics.wait(int32, 0, 0);
console.log(int32[0]); // 123
Operations:
Atomics.add(ta, 0, 12);
// returns 0, the old value
Atomics.load(ta, 0); // 12
OBJECT.ENTRIES() & OBJECT.VALUES()
Object.entries({ one: 1, two: 2 }) //[ [ 'one', 1 ], [ 'two', 2 ] ]
WHY
A better way to allow object entries iteration
let obj = { one: 1, two: 2 };
for (let [k,v] of Object.entries(obj)) {
console.log(`${JSON.stringify(k)}: ${JSON.stringify(v)}`);
}
Object.values({ one: 1, two: 2 }) //[ 1 , 2 ]
STRING PADDING
String.prototype.padStart(maxLength, fillString=' ‘)
String.prototype.padEnd(maxLength, fillString=' ')
WHY
Adding a count or an ID to a file name or a URL, for example
EXAMPLES
'x'.padStart(5, ‘ab') //‘ababx’
'x'.padEnd(5, ‘ab') //‘xabab’
OBJECT.GETOWNPROPERTYDESCRIPTORS()
const obj = {
[Symbol('foo')]: 123,
get bar() { return 'abc' },
};
console.log(Object.getOwnPropertyDescriptors(obj));
// Output:
// { [Symbol('foo')]:
// { value: 123,
// writable: true,
// enumerable: true,
// configurable: true },
// bar:
// { get: [Function: bar],
// set: undefined,
// enumerable: true,
// configurable: true } }
WHY
Copying properties into an object or cloning it
ES9 Current Draft
(2018)
+ OVERVIEW
OBJECT DESTRUCTURING (STAGE 3)
REST PROPERTIES
Analog to Array rest properties
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
x; // 1
y; // 2
z; // { a: 3, b: 4 }
SPREAD PROPERTIES
Analog to Array spread properties
let n = { x, y, ...z };
n; // { x: 1, y: 2, a: 3, b: 4 }
ASYNC ITERATION (STAGE 3)
for await (const line of readLines(filePath)) {
console.log(line);
}
const { value, done } = syncIterator.next();
asyncIterator.next().then(({ value, done }) => /* ... */);
WHY
A sequential iteration due to await to async operations
IMPORT() (STAGE 3)
import(`./section-modules/${link.dataset.entryModule}.js`)
.then(module => {
module.loadPageInto(main);
})
.catch(err => {
main.textContent = err.message;
});
WHY
Enabling dynamically load parts of a JavaScript application at runtime
THANK YOU

Más contenido relacionado

La actualidad más candente

Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test toolsAllan Huang
 
Java7 - Top 10 Features
Java7 - Top 10 FeaturesJava7 - Top 10 Features
Java7 - Top 10 FeaturesAndreas Enbohm
 
DeadLock Preventer
DeadLock PreventerDeadLock Preventer
DeadLock PreventerTeodor Madan
 
Иван Новиков «Elastic search»
Иван Новиков «Elastic search»Иван Новиков «Elastic search»
Иван Новиков «Elastic search»Mail.ru Group
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingLuciano Mammino
 
SQL Server 2005 CLR Integration
SQL Server 2005 CLR IntegrationSQL Server 2005 CLR Integration
SQL Server 2005 CLR Integrationwebhostingguy
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidEgor Andreevich
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJSAbul Hasan
 
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by OutbrainOB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by OutbrainEran Harel
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js PlatformNaresh Chintalcheru
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile DevelopmentJan Rybák Benetka
 
Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in JavaAllan Huang
 
JavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closuresJavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closuresHDR1001
 

La actualidad más candente (20)

Build, logging, and unit test tools
Build, logging, and unit test toolsBuild, logging, and unit test tools
Build, logging, and unit test tools
 
Java7 - Top 10 Features
Java7 - Top 10 FeaturesJava7 - Top 10 Features
Java7 - Top 10 Features
 
RxJava on Android
RxJava on AndroidRxJava on Android
RxJava on Android
 
Reactive Java (33rd Degree)
Reactive Java (33rd Degree)Reactive Java (33rd Degree)
Reactive Java (33rd Degree)
 
Scala
ScalaScala
Scala
 
DeadLock Preventer
DeadLock PreventerDeadLock Preventer
DeadLock Preventer
 
Иван Новиков «Elastic search»
Иван Новиков «Elastic search»Иван Новиков «Elastic search»
Иван Новиков «Elastic search»
 
Hybrid Applications
Hybrid ApplicationsHybrid Applications
Hybrid Applications
 
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computingCracking JWT tokens: a tale of magic, Node.JS and parallel computing
Cracking JWT tokens: a tale of magic, Node.JS and parallel computing
 
SQL Server 2005 CLR Integration
SQL Server 2005 CLR IntegrationSQL Server 2005 CLR Integration
SQL Server 2005 CLR Integration
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich Android
 
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
 
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by OutbrainOB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
OB1K - New, Better, Faster, Devops Friendly Java container by Outbrain
 
Automation patterns on practice
Automation patterns on practiceAutomation patterns on practice
Automation patterns on practice
 
Complete Java Course
Complete Java CourseComplete Java Course
Complete Java Course
 
Introduction to Node.js Platform
Introduction to Node.js PlatformIntroduction to Node.js Platform
Introduction to Node.js Platform
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
 
Concurrency in Java
Concurrency in  JavaConcurrency in  Java
Concurrency in Java
 
JavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closuresJavaScript global object, execution contexts & closures
JavaScript global object, execution contexts & closures
 

Similar a JavaScript Editions ES7, ES8 and ES9 vs V8

What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)Pavlo Baron
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptCaridy Patino
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is hereSebastiano Armeli
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
JCConf 2021 - Java17: The Next LTS
JCConf 2021 - Java17: The Next LTSJCConf 2021 - Java17: The Next LTS
JCConf 2021 - Java17: The Next LTSJoseph Kuo
 
Getting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascriptGetting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascriptMohd Saeed
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side JavascriptJulie Iskander
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript BootcampAndreCharland
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
 
What's New in JavaScript
What's New in JavaScriptWhat's New in JavaScript
What's New in JavaScriptDan Cohn
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation JavascriptRamesh Nair
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6Solution4Future
 
Weird Javascript Weekends first session presentaion
Weird Javascript Weekends first session presentaionWeird Javascript Weekends first session presentaion
Weird Javascript Weekends first session presentaionSrishtyMangutte
 
JavaScript (without DOM)
JavaScript (without DOM)JavaScript (without DOM)
JavaScript (without DOM)Piyush Katariya
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойSigma Software
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScriptMark Shelton
 

Similar a JavaScript Editions ES7, ES8 and ES9 vs V8 (20)

What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
MiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScriptMiamiJS - The Future of JavaScript
MiamiJS - The Future of JavaScript
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
JCConf 2021 - Java17: The Next LTS
JCConf 2021 - Java17: The Next LTSJCConf 2021 - Java17: The Next LTS
JCConf 2021 - Java17: The Next LTS
 
Es6 hackathon
Es6 hackathonEs6 hackathon
Es6 hackathon
 
Getting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascriptGetting started with ES6 : Future of javascript
Getting started with ES6 : Future of javascript
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
 
What's New in JavaScript
What's New in JavaScriptWhat's New in JavaScript
What's New in JavaScript
 
ES6 - Next Generation Javascript
ES6 - Next Generation JavascriptES6 - Next Generation Javascript
ES6 - Next Generation Javascript
 
JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6JavaScript - new features in ECMAScript 6
JavaScript - new features in ECMAScript 6
 
Weird Javascript Weekends first session presentaion
Weird Javascript Weekends first session presentaionWeird Javascript Weekends first session presentaion
Weird Javascript Weekends first session presentaion
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
JavaScript (without DOM)
JavaScript (without DOM)JavaScript (without DOM)
JavaScript (without DOM)
 
Столпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай МозговойСтолпы функционального программирования для адептов ООП, Николай Мозговой
Столпы функционального программирования для адептов ООП, Николай Мозговой
 
Coding in Style
Coding in StyleCoding in Style
Coding in Style
 
Functional Programming with JavaScript
Functional Programming with JavaScriptFunctional Programming with JavaScript
Functional Programming with JavaScript
 
JDBC – Java Database Connectivity
JDBC – Java Database ConnectivityJDBC – Java Database Connectivity
JDBC – Java Database Connectivity
 

Más de Rafael Casuso Romate

Rise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRafael Casuso Romate
 
Nuxt Avanzado (de Scaffolding a MVP)
Nuxt Avanzado (de Scaffolding a MVP)Nuxt Avanzado (de Scaffolding a MVP)
Nuxt Avanzado (de Scaffolding a MVP)Rafael Casuso Romate
 
Introduction to Weex: Mobile Apps with VueJS
Introduction to Weex: Mobile Apps with VueJSIntroduction to Weex: Mobile Apps with VueJS
Introduction to Weex: Mobile Apps with VueJSRafael Casuso Romate
 
Component-Oriented Progressive Web Applications with VueJS
Component-Oriented Progressive Web Applications with VueJSComponent-Oriented Progressive Web Applications with VueJS
Component-Oriented Progressive Web Applications with VueJSRafael Casuso Romate
 
Microservices Architecture For Conversational Intelligence Platform
Microservices Architecture For Conversational Intelligence PlatformMicroservices Architecture For Conversational Intelligence Platform
Microservices Architecture For Conversational Intelligence PlatformRafael Casuso Romate
 

Más de Rafael Casuso Romate (11)

Rise and Fall of the Frontend Developer
Rise and Fall of the Frontend DeveloperRise and Fall of the Frontend Developer
Rise and Fall of the Frontend Developer
 
Nuxt Avanzado (de Scaffolding a MVP)
Nuxt Avanzado (de Scaffolding a MVP)Nuxt Avanzado (de Scaffolding a MVP)
Nuxt Avanzado (de Scaffolding a MVP)
 
The Core of Agile
The Core of AgileThe Core of Agile
The Core of Agile
 
The Voice Interface Revolution
The Voice Interface RevolutionThe Voice Interface Revolution
The Voice Interface Revolution
 
Introduction to Weex: Mobile Apps with VueJS
Introduction to Weex: Mobile Apps with VueJSIntroduction to Weex: Mobile Apps with VueJS
Introduction to Weex: Mobile Apps with VueJS
 
Component-Oriented Progressive Web Applications with VueJS
Component-Oriented Progressive Web Applications with VueJSComponent-Oriented Progressive Web Applications with VueJS
Component-Oriented Progressive Web Applications with VueJS
 
Intro to VueJS Workshop
Intro to VueJS WorkshopIntro to VueJS Workshop
Intro to VueJS Workshop
 
Google Assistant Revolution
Google Assistant RevolutionGoogle Assistant Revolution
Google Assistant Revolution
 
VueJS in Action
VueJS in ActionVueJS in Action
VueJS in Action
 
VueJS: The Simple Revolution
VueJS: The Simple RevolutionVueJS: The Simple Revolution
VueJS: The Simple Revolution
 
Microservices Architecture For Conversational Intelligence Platform
Microservices Architecture For Conversational Intelligence PlatformMicroservices Architecture For Conversational Intelligence Platform
Microservices Architecture For Conversational Intelligence Platform
 

Último

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 

Último (20)

MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 

JavaScript Editions ES7, ES8 and ES9 vs V8

  • 2. @Rafael_Casuso A B O U T M E •CTO @StayApp •CEO @SnowStormIO •Organizer @BotDevMad & @VueJSMadrid •Software Engineer with +10 years of experience leading teams and developing. •Software Architect looking for revolutionary ways to change the world.
  • 4. JAVASCRIPT VERSIONS JAVASCRIPT (December 4th 1995) Netscape and Sun press release ECMAScript Standard Editions: ES1 (June 1997) Object-based, Scripting, Relaxed syntax, Prototypes ES2 (June 1998) Editorial changes for ISO 16262 ES3 (December 1999) Regexps, Try/Catch, Do-While, String methods ES5 (December 2009) Strict mode, JSON, .bind, Object mts, Array mts ES5.1 (June 2011) Editorial changes for ISO 16262:2011 ES6 (June 2015) Classes, Modules, Arrow Fs, Generators, Const/Let,
 Destructuring, Template Literals, Promise, Proxy, Symbol, Reflect ES7 (June 2016) Exponentiation operator (**) and Array Includes ES8 (June 2017) Async Fs, Shared Memory & Atomics
  • 5. JAVASCRIPT ENGINES V8 (Chrome V8) by Google Used in Chromium/Chrome & NodeJS SPIDERMONKEY by Mozilla Foundation Used in Gecko/Mozilla Firefox & SpiderNode CHAKRACORE, by Microsoft Used in Edge & Node ChakraCore JAVASCRIPTCORE by Apple RHINO Written in Java
  • 7. TECHNICAL COMMITEES TC39 Its members are companies Operates by consensus Evolves the standard Yearly edition using TC39 process TSC (Technical Steering Committee) Key contributors with technical expertise and commitment Frequent meetings Chooses Collaborators (300+) Define Working Groups over Specific Areas
  • 8. RELEASE PROCESS TC39 PROCESS STAGE 0: STRAWMAN Submitted ideas by TC39 member or contributor STAGE 1: PROPOSAL TC39 member responsible (Champion). Problem described in prose, solution via examples, API. Obstacles identification. STAGE 2: DRAFT First version of eventual inclusion. Formal description of syntax and semantics. Two experimental implementations needed. STAGE 3: CANDIDATE Feedback stage. Designated reviewer and TC39 editor must sign-off. Two spec-compliant implementations. STAGE 4: FINISHED Ready for standard. Test262 unit tests for the feature. Two implementations that pass tests. TC39 editor’s approval. STANDARD EDITION Each June and ongoing DRAFT with Stage 4 features.
  • 10. ARRAY INCLUDES Array.prototype.includes(searchElement[, fromIndex]) // => Boolean WHY array.indexOf(el) !== -1 || array.indexOf(el) >= 0 It does not work with NaN Not explicit syntax EXAMPLES assert([1, 2, 3].includes(2) === true); assert([1, 2, 3].includes(4) === false); assert([1, 2, NaN].includes(NaN) === true); assert(["a", "b", "c"].includes("a") === true); assert(["a", "b", "c"].includes("a", 1) === false);
  • 11. EXPONENTIATION OPERATOR x ** y // => Math.pow(x, y) WHY Math.pow(x, y) More succint syntax EXAMPLES let squared = 3 ** 2; // 9 let num = 3; num **= 3; // 9
  • 13. ASYNC FUNCTIONS async function () {} async () => {} //=> Promise WHY Sequential much more succinct way to deal with Asynchrony Better understandable than callbacks (no jumps) and mere Promises Basic implementation async function asyncFunc() { return 123 }; asyncFunc().then( x => console.log(x) ); //=> 123 async function asyncFunc() { throw new Error(‘Problem’) }; asyncFunc().catch( err => console.log(err) ); //=> Error: Problem
  • 14. ASYNC FUNCTIONS: AWAIT OPERATOR async function asyncFunc() { const result1 = await otherAsyncFunc1(); //Waits for Promise1 to settle console.log(result1); const result2 = await otherAsyncFunc2(); //Waits for Promise2 to settle console.log(result2); try { await otherAsyncFunc3() } catch(e) { //Handles err } } If Promise is resolved await returns its value If it is rejected it throws an exception (so Try/Catch is encouraged) If operand is not a Promise it converts it to a resolved one Don’t forget it. It has use case even if async function does not return. You don’t need await if you “fire and forget” Use Promise.all (parallel) instead of multiple await (sequential) whenever possible
  • 15. ASYNC FUNCTIONS: EXECUTION 1) Async function is started synchronously. Its return Promise is created. 2) Its body is executed. It ends permanently via return (resolves Promise with value) or throw (rejects Promise with error). It ends temporarily via await (and resumed later). 3) Its Promise is returned. Notification of Promise resolution happens asynchronously, so .then or .catch will always be executed after. async function asyncFunc() { console.log(‘1’); return ‘3’; } asyncFunc().then( x => console.log(x); console.log(‘2’); //1 //2 //3
  • 16. PARALLELISM & CONCURRENCY Parallelism (parallel vs serial): Execute multiple tasks simultaneously Data Parallelism: Same code is executed several times in parallel through instances on different elements of same datset (Ex: MapReduce) Task Parallelism: Different code is executed in parallel (Ex: Web Workers) Concurrency (concurrent vs sequential): Execute several tasks during overlapping periods of time Web Workers brought Task Parallelism to usually single-thread JavaScript They hay a dedicated global scope Communication between workers and main thread by messaging system They can communicate cloned data structures Transferable objects are cleared from sender and owned by receiver
  • 17. SHARED ARRAY BUFFER Primitive building-block for high-level concurrency abstractions Share the bytes of SharedArrayBuffer between multiple workers and the main thread You can share data between workers more quickly Coordination between workers becomes simpler and faster Currently only Array of Integers can be shared // main.js const worker = new Worker('worker.js'); // To be shared const sharedBuffer = new SharedArrayBuffer(10 * Int32Array.BYTES_PER_ELEMENT); // 10 elements // Share sharedBuffer with the worker worker.postMessage({sharedBuffer}); // clone // worker.js self.addEventListener('message', function (event) { const {sharedBuffer} = event.data; const sharedArray = new Int32Array(sharedBuffer); // ··· });
  • 18. ATOMICS Global variable to synchronize the activity of multiple workers using same SharedArrayBuffer Synchronization: // main.js console.log('notifying...'); Atomics.store(sharedArray, 0, 123); // worker.js while (Atomics.load(sharedArray, 0) !== 123) ; console.log('notified'); Waiting: Atomics.wait(int32, 0, 0); console.log(int32[0]); // 123 Operations: Atomics.add(ta, 0, 12); // returns 0, the old value Atomics.load(ta, 0); // 12
  • 19. OBJECT.ENTRIES() & OBJECT.VALUES() Object.entries({ one: 1, two: 2 }) //[ [ 'one', 1 ], [ 'two', 2 ] ] WHY A better way to allow object entries iteration let obj = { one: 1, two: 2 }; for (let [k,v] of Object.entries(obj)) { console.log(`${JSON.stringify(k)}: ${JSON.stringify(v)}`); } Object.values({ one: 1, two: 2 }) //[ 1 , 2 ]
  • 20. STRING PADDING String.prototype.padStart(maxLength, fillString=' ‘) String.prototype.padEnd(maxLength, fillString=' ') WHY Adding a count or an ID to a file name or a URL, for example EXAMPLES 'x'.padStart(5, ‘ab') //‘ababx’ 'x'.padEnd(5, ‘ab') //‘xabab’
  • 21. OBJECT.GETOWNPROPERTYDESCRIPTORS() const obj = { [Symbol('foo')]: 123, get bar() { return 'abc' }, }; console.log(Object.getOwnPropertyDescriptors(obj)); // Output: // { [Symbol('foo')]: // { value: 123, // writable: true, // enumerable: true, // configurable: true }, // bar: // { get: [Function: bar], // set: undefined, // enumerable: true, // configurable: true } } WHY Copying properties into an object or cloning it
  • 23. OBJECT DESTRUCTURING (STAGE 3) REST PROPERTIES Analog to Array rest properties let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 }; x; // 1 y; // 2 z; // { a: 3, b: 4 } SPREAD PROPERTIES Analog to Array spread properties let n = { x, y, ...z }; n; // { x: 1, y: 2, a: 3, b: 4 }
  • 24. ASYNC ITERATION (STAGE 3) for await (const line of readLines(filePath)) { console.log(line); } const { value, done } = syncIterator.next(); asyncIterator.next().then(({ value, done }) => /* ... */); WHY A sequential iteration due to await to async operations
  • 25. IMPORT() (STAGE 3) import(`./section-modules/${link.dataset.entryModule}.js`) .then(module => { module.loadPageInto(main); }) .catch(err => { main.textContent = err.message; }); WHY Enabling dynamically load parts of a JavaScript application at runtime