SlideShare ist ein Scribd-Unternehmen logo
1 von 14
Downloaden Sie, um offline zu lesen
ECMAScript 6 Harmony
Major Changes
• class, module
• ‘const’,‘let’, destructuring
• for of
• Iterator and generator
• Default parameter
• Rest parameter and spread
• Arrow function
• Map, Set,WeakMap
• Array comprehension
• Proxy
• String extra, quasi-string literal
• Binary, octet, unicode literal
class, module
• class, extends
• constructor
• super
• module
• import, export
import $ from “jQuery”;
module “point” {
export class PointT extends Time {
constructor(x, y, t) {
super(t);
public getX() { return x; }
public getY() { return y; }
}
toString() {
return '<' + this.getX() + ',' + this.getY() + '>';
}
}
}
import PointT from “point”;
‘const’,‘let’, destructuring
• const
• let
• [x, y] = [y, x]
function Point5(x, y) {
const offset = 5;
if (x < offset) {
let y = 1;
x += y;
}
[x, y] = [ x+offset, y + offset];
return {x: x, y: y};
}
for of
• for (n of [ 1, 2, 3, 4, 5]) function Point6(x, y) {
var r = [1, 2, 3, 4, 5, 6, 7, 8, 9];
for (n of r) {
y = x + n;
}
return y;
}
Iterator and generator
• Iterator()
• #.next()
• yield
function Range(low, high) {
this.low = low;
this.high = high;
}
function RangeIterator(range) {
this.range = range;
this.current = this.range.low;
}
RangeIterator.prototype.next = function() {
if (this.current > this.range.high)
throw StopIteration;
else
return this.current++;
};
Range.prototype.__iterator__ = function() {
return new RangeIterator(this);
};
var range = new Range(3, 5);
for (var i in range) console.log(i);
function Range(low, high){
this.low = low;
this.high = high;
}
Range.prototype.__iterator__ = function(){
for (var i = this.low; i <= this.high; i++)
yield i;
};
Default parameter
• function (x=2) { } function Point7(x = 0, y = 0) {
return { x: x, y: y };
}
var p = Point7();
Rest parameter and spread
• function (...z) { }
• [1, 2, 3, ...[5, 6, 7]]
• f(...[2, 4, 6])
function f(w, x, y, z) {
return w * 1000 + x * 100 + y * 10 + z;
}
function g(...v) {
var w = v.length > 0 ? v[0] : 0;
var x = v.length > 1 ? v[1] : 0;
var y = v.length > 2 ? v[2] : 0;
var z = v.length > 3 ? v[3] : 0;
return w * 1000 + x * 100 + y * 10 + z;
}
var p = [2, 4, 6];
var q = [5, 7, ...p];
console.log(f(2,4,6,0));
console.log(g(2,4,6));
console.log(g(...q));
Arrow function
• function (a, b) { return a * b; }
• (a, b) => { a * b; }
• (a, b) => a * b;
• x => x * 3;
• () => {};
let empty = () => {};
 
let identity = x => x;
 
let square = x => x * x;
 
let key_maker = val => ({key: val});
 
let odds = evens.map(v => v + 1);
 
let fives = [];
nats.forEach(v => { if (v % 5 === 0) fives.push(v); });
 
const obj = {
method: function () {
return () => this;
}
};
assert(obj.method()() === obj);
Map, Set,WeakMap
• new Map()
• new Set()
• new WeakMap()
var m = new Map();
var s = new Set();
var w = new WeakMap();
var ko = {}, kf = function(){};
m.set(ko “object”);
m.set(kf,“function”);
m.set(“a”,“string”);
m.size == 3;
m.get(“a”);
m.get(ko);
m.get(kf);
s.set(5);
s.set(“string”);
s.size == 2;
s.has(5);
for (var n of s) console.log(n);
Array comprehension
• [n for (n of [5, 6, 7])] var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var b = [n*2 for (n of a)];
var c = [n for (n of a) if (n % 2)];
var d = [i+j for (i of a) for (j of a)];
Proxy
• new Proxy({}, {}) var handler = {
get: function(target, name){
return name in target?
target[name] :
37;
}
};
var p = new Proxy({}, handler);
p.a = 1;
p.b = undefined;
console.log(p.a, p.b); // 1, undefined
console.log('c' in p, p.c); // false, 37
String extra, quasi-string literal
• startsWith
• endsWith
• contains
• toArray
• f`hello ${name}`
var s = “String extra, quasi-string literal”;
s.startsWith(“String”) == true;
s.endsWith(“literal”) == true;
s.contains(“quasi”) == true;
s.toArray();
function f(s) {
console.log(s);
return s;
}
var name = “everyone”;
f`hello ${name}.`;
Binary, octet, unicode literal
• 0b010101
• 0o77
• 'u{1d306}' == 'ud834udf06'

Weitere ähnliche Inhalte

Was ist angesagt?

OpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシングOpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシングToshihiro Kamishima
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignmentashikul akash
 
Wap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithmWap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithmKapil Pandit
 
Superficies en maple
Superficies en mapleSuperficies en maple
Superficies en mapleaart07
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicalsManoj Chauhan
 
Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonChristoph Matthies
 
ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions Dr. Volkan OBAN
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacionJeff Tu Pechito
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3San Kim
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..Dr. Volkan OBAN
 
The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180Mahmoud Samir Fayed
 

Was ist angesagt? (20)

OpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシングOpenOpt の線形計画で圧縮センシング
OpenOpt の線形計画で圧縮センシング
 
Vcs9
Vcs9Vcs9
Vcs9
 
C questions
C questionsC questions
C questions
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
Wap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithmWap in c to draw a line using DDA algorithm
Wap in c to draw a line using DDA algorithm
 
Superficies en maple
Superficies en mapleSuperficies en maple
Superficies en maple
 
R meets Hadoop
R meets HadoopR meets Hadoop
R meets Hadoop
 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
 
computer graphics practicals
computer graphics practicalscomputer graphics practicals
computer graphics practicals
 
Computer graphics
Computer graphics   Computer graphics
Computer graphics
 
Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in Python
 
ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions ggtimeseries-->ggplot2 extensions
ggtimeseries-->ggplot2 extensions
 
JVM Architecture - Java
JVM Architecture - JavaJVM Architecture - Java
JVM Architecture - Java
 
RHadoop の紹介
RHadoop の紹介RHadoop の紹介
RHadoop の紹介
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
 
Deep learning study 3
Deep learning study 3Deep learning study 3
Deep learning study 3
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..
 
The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180The Ring programming language version 1.5.1 book - Part 51 of 180
The Ring programming language version 1.5.1 book - Part 51 of 180
 
Caropro
CaroproCaropro
Caropro
 
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
 

Andere mochten auch

Let's get agile: An Agile Talk About Agile
Let's get agile: An Agile Talk About AgileLet's get agile: An Agile Talk About Agile
Let's get agile: An Agile Talk About AgileJesse Houwing
 
Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...
Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...
Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...Kevin Shea
 
Expande tu Negocio con Email Marketing
Expande tu Negocio con Email MarketingExpande tu Negocio con Email Marketing
Expande tu Negocio con Email MarketingArmando Ehrenzweig
 
Lg15fall cara à cara30octf
Lg15fall cara à cara30octfLg15fall cara à cara30octf
Lg15fall cara à cara30octfkatherine watson
 
Campamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja Escuela
Campamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja EscuelaCampamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja Escuela
Campamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja EscuelaVeleta3000
 
Presentacion pp calafate y glaciar perito moreno
Presentacion pp calafate y glaciar perito morenoPresentacion pp calafate y glaciar perito moreno
Presentacion pp calafate y glaciar perito morenosilviaoswald
 
Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...
Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...
Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...Anibal Leon Fernandez
 
Government Publications August 2015 Library Guide (4)
Government Publications August 2015 Library Guide (4)Government Publications August 2015 Library Guide (4)
Government Publications August 2015 Library Guide (4)Mary Howrey
 
Povertyy education
Povertyy educationPovertyy education
Povertyy educationTARIQ KHAN
 
European flags
European flagsEuropean flags
European flagsivid1990
 
Boletim Dom Edilberto - outubro/2013 - nº 56
Boletim Dom Edilberto - outubro/2013 - nº 56Boletim Dom Edilberto - outubro/2013 - nº 56
Boletim Dom Edilberto - outubro/2013 - nº 56escoladomedilberto
 
Glosario ecologia y calentmiento
Glosario ecologia y calentmientoGlosario ecologia y calentmiento
Glosario ecologia y calentmientoDeuglissabino
 
Ansiedad y angustia
Ansiedad y angustiaAnsiedad y angustia
Ansiedad y angustiaeduarfrasa
 
Flipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-Dorr
Flipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-DorrFlipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-Dorr
Flipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-Dorrmhhighered
 
Conceptos
ConceptosConceptos
Conceptosnay_isa
 
Actividad de aprendisaje nª 8
Actividad de aprendisaje nª 8Actividad de aprendisaje nª 8
Actividad de aprendisaje nª 8migelx
 
El futuro de_la_comunicacion_1_
El futuro de_la_comunicacion_1_El futuro de_la_comunicacion_1_
El futuro de_la_comunicacion_1_leslyevqz
 

Andere mochten auch (20)

Let's get agile: An Agile Talk About Agile
Let's get agile: An Agile Talk About AgileLet's get agile: An Agile Talk About Agile
Let's get agile: An Agile Talk About Agile
 
Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...
Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...
Case Study: Enhancing Sponsor Value through the Extension of Vendor-provided ...
 
Expande tu Negocio con Email Marketing
Expande tu Negocio con Email MarketingExpande tu Negocio con Email Marketing
Expande tu Negocio con Email Marketing
 
Lg15fall cara à cara30octf
Lg15fall cara à cara30octfLg15fall cara à cara30octf
Lg15fall cara à cara30octf
 
Campamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja Escuela
Campamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja EscuelaCampamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja Escuela
Campamentos de Verano Sierra de Cadiz Aula Naturaleza y Granja Escuela
 
Presentacion pp calafate y glaciar perito moreno
Presentacion pp calafate y glaciar perito morenoPresentacion pp calafate y glaciar perito moreno
Presentacion pp calafate y glaciar perito moreno
 
Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...
Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...
Relaciones Públicas. 2.0: El uso de los medios sociales en la estrategia de c...
 
Government Publications August 2015 Library Guide (4)
Government Publications August 2015 Library Guide (4)Government Publications August 2015 Library Guide (4)
Government Publications August 2015 Library Guide (4)
 
Povertyy education
Povertyy educationPovertyy education
Povertyy education
 
European flags
European flagsEuropean flags
European flags
 
Boletim Dom Edilberto - outubro/2013 - nº 56
Boletim Dom Edilberto - outubro/2013 - nº 56Boletim Dom Edilberto - outubro/2013 - nº 56
Boletim Dom Edilberto - outubro/2013 - nº 56
 
Glosario ecologia y calentmiento
Glosario ecologia y calentmientoGlosario ecologia y calentmiento
Glosario ecologia y calentmiento
 
Ansiedad y angustia
Ansiedad y angustiaAnsiedad y angustia
Ansiedad y angustia
 
Flipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-Dorr
Flipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-DorrFlipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-Dorr
Flipping the Classroom with McGraw-Hill Connect - Dana'e Quirk-Dorr
 
Conceptos
ConceptosConceptos
Conceptos
 
Tarea 8
Tarea 8Tarea 8
Tarea 8
 
Actividad de aprendisaje nª 8
Actividad de aprendisaje nª 8Actividad de aprendisaje nª 8
Actividad de aprendisaje nª 8
 
Fluoxetine 2002
Fluoxetine 2002Fluoxetine 2002
Fluoxetine 2002
 
Damai residences and lifestyle
Damai residences and lifestyleDamai residences and lifestyle
Damai residences and lifestyle
 
El futuro de_la_comunicacion_1_
El futuro de_la_comunicacion_1_El futuro de_la_comunicacion_1_
El futuro de_la_comunicacion_1_
 

Ähnlich wie ECMAScript 6 major changes

Bindings: the zen of montage
Bindings: the zen of montageBindings: the zen of montage
Bindings: the zen of montageKris Kowal
 
ES6 and AngularAMD
ES6 and AngularAMDES6 and AngularAMD
ES6 and AngularAMDdhaval10690
 
Create a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfarihantmobileselepun
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Javascript Uncommon Programming
Javascript Uncommon ProgrammingJavascript Uncommon Programming
Javascript Uncommon Programmingjeffz
 
package chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdfpackage chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdfKARTIKINDIA
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring CanvasKevin Hoyt
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentationsharp-blade
 
Python 101 language features and functional programming
Python 101 language features and functional programmingPython 101 language features and functional programming
Python 101 language features and functional programmingLukasz Dynowski
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)jeffz
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)hhliu
 
深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscexjeffz
 
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽tbosstraining
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualUma mohan
 

Ähnlich wie ECMAScript 6 major changes (20)

Bindings: the zen of montage
Bindings: the zen of montageBindings: the zen of montage
Bindings: the zen of montage
 
ES6 and AngularAMD
ES6 and AngularAMDES6 and AngularAMD
ES6 and AngularAMD
 
Create a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdfCreate a java project that - Draw a circle with three random init.pdf
Create a java project that - Draw a circle with three random init.pdf
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Javascript Uncommon Programming
Javascript Uncommon ProgrammingJavascript Uncommon Programming
Javascript Uncommon Programming
 
package chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdfpackage chapter15;import javafx.application.Application;import j.pdf
package chapter15;import javafx.application.Application;import j.pdf
 
Exploring Canvas
Exploring CanvasExploring Canvas
Exploring Canvas
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
 
Python 101 language features and functional programming
Python 101 language features and functional programmingPython 101 language features and functional programming
Python 101 language features and functional programming
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
 
Javascript
JavascriptJavascript
Javascript
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
深入浅出Jscex
深入浅出Jscex深入浅出Jscex
深入浅出Jscex
 
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
【第一季第三期】Thinking in Javascript & OO in Javascript - 清羽
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
ES6, WTF?
ES6, WTF?ES6, WTF?
ES6, WTF?
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 

Kürzlich hochgeladen

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

ECMAScript 6 major changes

  • 2. Major Changes • class, module • ‘const’,‘let’, destructuring • for of • Iterator and generator • Default parameter • Rest parameter and spread • Arrow function • Map, Set,WeakMap • Array comprehension • Proxy • String extra, quasi-string literal • Binary, octet, unicode literal
  • 3. class, module • class, extends • constructor • super • module • import, export import $ from “jQuery”; module “point” { export class PointT extends Time { constructor(x, y, t) { super(t); public getX() { return x; } public getY() { return y; } } toString() { return '<' + this.getX() + ',' + this.getY() + '>'; } } } import PointT from “point”;
  • 4. ‘const’,‘let’, destructuring • const • let • [x, y] = [y, x] function Point5(x, y) { const offset = 5; if (x < offset) { let y = 1; x += y; } [x, y] = [ x+offset, y + offset]; return {x: x, y: y}; }
  • 5. for of • for (n of [ 1, 2, 3, 4, 5]) function Point6(x, y) { var r = [1, 2, 3, 4, 5, 6, 7, 8, 9]; for (n of r) { y = x + n; } return y; }
  • 6. Iterator and generator • Iterator() • #.next() • yield function Range(low, high) { this.low = low; this.high = high; } function RangeIterator(range) { this.range = range; this.current = this.range.low; } RangeIterator.prototype.next = function() { if (this.current > this.range.high) throw StopIteration; else return this.current++; }; Range.prototype.__iterator__ = function() { return new RangeIterator(this); }; var range = new Range(3, 5); for (var i in range) console.log(i); function Range(low, high){ this.low = low; this.high = high; } Range.prototype.__iterator__ = function(){ for (var i = this.low; i <= this.high; i++) yield i; };
  • 7. Default parameter • function (x=2) { } function Point7(x = 0, y = 0) { return { x: x, y: y }; } var p = Point7();
  • 8. Rest parameter and spread • function (...z) { } • [1, 2, 3, ...[5, 6, 7]] • f(...[2, 4, 6]) function f(w, x, y, z) { return w * 1000 + x * 100 + y * 10 + z; } function g(...v) { var w = v.length > 0 ? v[0] : 0; var x = v.length > 1 ? v[1] : 0; var y = v.length > 2 ? v[2] : 0; var z = v.length > 3 ? v[3] : 0; return w * 1000 + x * 100 + y * 10 + z; } var p = [2, 4, 6]; var q = [5, 7, ...p]; console.log(f(2,4,6,0)); console.log(g(2,4,6)); console.log(g(...q));
  • 9. Arrow function • function (a, b) { return a * b; } • (a, b) => { a * b; } • (a, b) => a * b; • x => x * 3; • () => {}; let empty = () => {};   let identity = x => x;   let square = x => x * x;   let key_maker = val => ({key: val});   let odds = evens.map(v => v + 1);   let fives = []; nats.forEach(v => { if (v % 5 === 0) fives.push(v); });   const obj = { method: function () { return () => this; } }; assert(obj.method()() === obj);
  • 10. Map, Set,WeakMap • new Map() • new Set() • new WeakMap() var m = new Map(); var s = new Set(); var w = new WeakMap(); var ko = {}, kf = function(){}; m.set(ko “object”); m.set(kf,“function”); m.set(“a”,“string”); m.size == 3; m.get(“a”); m.get(ko); m.get(kf); s.set(5); s.set(“string”); s.size == 2; s.has(5); for (var n of s) console.log(n);
  • 11. Array comprehension • [n for (n of [5, 6, 7])] var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; var b = [n*2 for (n of a)]; var c = [n for (n of a) if (n % 2)]; var d = [i+j for (i of a) for (j of a)];
  • 12. Proxy • new Proxy({}, {}) var handler = { get: function(target, name){ return name in target? target[name] : 37; } }; var p = new Proxy({}, handler); p.a = 1; p.b = undefined; console.log(p.a, p.b); // 1, undefined console.log('c' in p, p.c); // false, 37
  • 13. String extra, quasi-string literal • startsWith • endsWith • contains • toArray • f`hello ${name}` var s = “String extra, quasi-string literal”; s.startsWith(“String”) == true; s.endsWith(“literal”) == true; s.contains(“quasi”) == true; s.toArray(); function f(s) { console.log(s); return s; } var name = “everyone”; f`hello ${name}.`;
  • 14. Binary, octet, unicode literal • 0b010101 • 0o77 • 'u{1d306}' == 'ud834udf06'