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
 
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
 
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
 
Proga 0622
Proga 0622Proga 0622
Proga 0622
 

Kürzlich hochgeladen

OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioChristian Posta
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 

Kürzlich hochgeladen (20)

OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Comparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and IstioComparing Sidecar-less Service Mesh from Cilium and Istio
Comparing Sidecar-less Service Mesh from Cilium and Istio
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 

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'