Enviar pesquisa
Carregar
What’s new in ECMAScript 6.0
•
41 gostaram
•
11,365 visualizações
Eyal Vardi
Seguir
What’s new in ECMAScript 6.0
Leia menos
Leia mais
Tecnologia
Negócios
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 74
Recomendados
ES6: The Awesome Parts
ES6: The Awesome Parts
Domenic Denicola
Unbreakable: The Craft of Code
Unbreakable: The Craft of Code
Joe Morgan
Say It With Javascript
Say It With Javascript
Giovanni Scerra ☃
ES6 patterns in the wild
ES6 patterns in the wild
Joe Morgan
ES6 PPT FOR 2016
ES6 PPT FOR 2016
Manoj Kumar
JavaScript Promise
JavaScript Promise
Joseph Chiang
My app is secure... I think
My app is secure... I think
Wim Godden
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...
Codemotion
Recomendados
ES6: The Awesome Parts
ES6: The Awesome Parts
Domenic Denicola
Unbreakable: The Craft of Code
Unbreakable: The Craft of Code
Joe Morgan
Say It With Javascript
Say It With Javascript
Giovanni Scerra ☃
ES6 patterns in the wild
ES6 patterns in the wild
Joe Morgan
ES6 PPT FOR 2016
ES6 PPT FOR 2016
Manoj Kumar
JavaScript Promise
JavaScript Promise
Joseph Chiang
My app is secure... I think
My app is secure... I think
Wim Godden
And now you have two problems. Ruby regular expressions for fun and profit by...
And now you have two problems. Ruby regular expressions for fun and profit by...
Codemotion
Nubilus Perl
Nubilus Perl
Flavio Poletti
Writing Your App Swiftly
Writing Your App Swiftly
Sommer Panage
Perl Web Client
Perl Web Client
Flavio Poletti
My app is secure... I think
My app is secure... I think
Wim Godden
The promise of asynchronous php
The promise of asynchronous php
Wim Godden
A Little Backbone For Your App
A Little Backbone For Your App
Luca Mearelli
Koajs as an alternative to Express - OdessaJs'16
Koajs as an alternative to Express - OdessaJs'16
Nikolay Kozhukharenko
Build Lightweight Web Module
Build Lightweight Web Module
Morgan Cheng
AngularJS Tips&Tricks
AngularJS Tips&Tricks
Petr Bela
Frontin like-a-backer
Frontin like-a-backer
Frank de Jonge
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
Konstantin Kudryashov
dotCloud and go
dotCloud and go
Flavio Poletti
JavaScript Unit Testing with Jasmine
JavaScript Unit Testing with Jasmine
Raimonds Simanovskis
Django Celery - A distributed task queue
Django Celery - A distributed task queue
Alex Eftimie
Writing Redis in Python with asyncio
Writing Redis in Python with asyncio
James Saryerwinnie
Min-Maxing Software Costs
Min-Maxing Software Costs
Konstantin Kudryashov
Advanced symfony Techniques
Advanced symfony Techniques
Kris Wallsmith
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
Daniel Spector
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
Konstantin Kudryashov
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Ignacio Martín
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Mais conteúdo relacionado
Mais procurados
Nubilus Perl
Nubilus Perl
Flavio Poletti
Writing Your App Swiftly
Writing Your App Swiftly
Sommer Panage
Perl Web Client
Perl Web Client
Flavio Poletti
My app is secure... I think
My app is secure... I think
Wim Godden
The promise of asynchronous php
The promise of asynchronous php
Wim Godden
A Little Backbone For Your App
A Little Backbone For Your App
Luca Mearelli
Koajs as an alternative to Express - OdessaJs'16
Koajs as an alternative to Express - OdessaJs'16
Nikolay Kozhukharenko
Build Lightweight Web Module
Build Lightweight Web Module
Morgan Cheng
AngularJS Tips&Tricks
AngularJS Tips&Tricks
Petr Bela
Frontin like-a-backer
Frontin like-a-backer
Frank de Jonge
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
Konstantin Kudryashov
dotCloud and go
dotCloud and go
Flavio Poletti
JavaScript Unit Testing with Jasmine
JavaScript Unit Testing with Jasmine
Raimonds Simanovskis
Django Celery - A distributed task queue
Django Celery - A distributed task queue
Alex Eftimie
Writing Redis in Python with asyncio
Writing Redis in Python with asyncio
James Saryerwinnie
Min-Maxing Software Costs
Min-Maxing Software Costs
Konstantin Kudryashov
Advanced symfony Techniques
Advanced symfony Techniques
Kris Wallsmith
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
Daniel Spector
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
Konstantin Kudryashov
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Ignacio Martín
Mais procurados
(20)
Nubilus Perl
Nubilus Perl
Writing Your App Swiftly
Writing Your App Swiftly
Perl Web Client
Perl Web Client
My app is secure... I think
My app is secure... I think
The promise of asynchronous php
The promise of asynchronous php
A Little Backbone For Your App
A Little Backbone For Your App
Koajs as an alternative to Express - OdessaJs'16
Koajs as an alternative to Express - OdessaJs'16
Build Lightweight Web Module
Build Lightweight Web Module
AngularJS Tips&Tricks
AngularJS Tips&Tricks
Frontin like-a-backer
Frontin like-a-backer
Min-Maxing Software Costs - Laracon EU 2015
Min-Maxing Software Costs - Laracon EU 2015
dotCloud and go
dotCloud and go
JavaScript Unit Testing with Jasmine
JavaScript Unit Testing with Jasmine
Django Celery - A distributed task queue
Django Celery - A distributed task queue
Writing Redis in Python with asyncio
Writing Redis in Python with asyncio
Min-Maxing Software Costs
Min-Maxing Software Costs
Advanced symfony Techniques
Advanced symfony Techniques
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
Decoupling with Design Patterns and Symfony2 DIC
Decoupling with Design Patterns and Symfony2 DIC
Symfony & Javascript. Combining the best of two worlds
Symfony & Javascript. Combining the best of two worlds
Semelhante a What’s new in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
Eyal Vardi
Node.js Event Emitter
Node.js Event Emitter
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Node js overview
Node js overview
Eyal Vardi
OOP in JavaScript
OOP in JavaScript
Eyal Vardi
Node.js File system & Streams
Node.js File system & Streams
Eyal Vardi
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Eyal Vardi
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Eyal Vardi
AMD & Require.js
AMD & Require.js
Eyal Vardi
Adding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer Toolbox
Jeff Strauss
Node.js Express
Node.js Express
Eyal Vardi
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
Eyal Vardi
Forms in AngularJS
Forms in AngularJS
Eyal Vardi
The Future of JavaScript (SXSW '07)
The Future of JavaScript (SXSW '07)
Aaron Gustafson
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
Rob Tweed
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
Eyal Vardi
ES2015 New Features
ES2015 New Features
Giacomo Zinetti
JavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
Semelhante a What’s new in ECMAScript 6.0
(20)
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
Node.js Event Emitter
Node.js Event Emitter
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Node js overview
Node js overview
OOP in JavaScript
OOP in JavaScript
Node.js File system & Streams
Node.js File system & Streams
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
AMD & Require.js
AMD & Require.js
Adding ES6 to Your Developer Toolbox
Adding ES6 to Your Developer Toolbox
Node.js Express
Node.js Express
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
Forms in AngularJS
Forms in AngularJS
The Future of JavaScript (SXSW '07)
The Future of JavaScript (SXSW '07)
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
EWD 3 Training Course Part 43: Using JSON Web Tokens with QEWD REST Services
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
ES2015 New Features
ES2015 New Features
JavaScript for PHP developers
JavaScript for PHP developers
Mais de Eyal Vardi
Why magic
Why magic
Eyal Vardi
Smart Contract
Smart Contract
Eyal Vardi
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Eyal Vardi
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Eyal Vardi
Angular 2 NgModule
Angular 2 NgModule
Eyal Vardi
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Eyal Vardi
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Eyal Vardi
Routing And Navigation
Routing And Navigation
Eyal Vardi
Angular 2 Architecture
Angular 2 Architecture
Eyal Vardi
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Eyal Vardi
Angular 2.0 Views
Angular 2.0 Views
Eyal Vardi
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Eyal Vardi
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Eyal Vardi
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Eyal Vardi
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Eyal Vardi
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Eyal Vardi
Angular 2.0 Pipes
Angular 2.0 Pipes
Eyal Vardi
Angular 2.0 forms
Angular 2.0 forms
Eyal Vardi
Modules and injector
Modules and injector
Eyal Vardi
Mais de Eyal Vardi
(20)
Why magic
Why magic
Smart Contract
Smart Contract
Rachel's grandmother's recipes
Rachel's grandmother's recipes
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 Architecture (Bucharest 26/10/2016)
Angular 2 NgModule
Angular 2 NgModule
Upgrading from Angular 1.x to Angular 2.x
Upgrading from Angular 1.x to Angular 2.x
Angular 2 - Ahead of-time Compilation
Angular 2 - Ahead of-time Compilation
Routing And Navigation
Routing And Navigation
Angular 2 Architecture
Angular 2 Architecture
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
Angular 2.0 Views
Angular 2.0 Views
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
Template syntax in Angular 2.0
Template syntax in Angular 2.0
Http Communication in Angular 2.0
Http Communication in Angular 2.0
Angular 2.0 Dependency injection
Angular 2.0 Dependency injection
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
Angular 2.0 Pipes
Angular 2.0 Pipes
Angular 2.0 forms
Angular 2.0 forms
Modules and injector
Modules and injector
Último
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Igalia
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Pixlogix Infotech
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Andrey Devyatkin
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Remote DBA Services
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Enterprise Knowledge
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Khem
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
apidays
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
Martijn de Jong
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Anna Loughnan Colquhoun
Último
(20)
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
What’s new in ECMAScript 6.0
1.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
2.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
3.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
4.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
5.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
6.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
7.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
8.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
9.
var es =
[]; for (var i = 0; i < 10; i++) { es[i] = function () { console.log("i = " + i); }; } es[6](); // i = 10 var es = []; for (var i = 0; i < 10; i++) { let c = i; es[i] = function () { console.log("i = " + c); }; } es[6](); // i = 6 © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
10.
const PI =
3.14159; // Can't re-assign PI = 3; console.log(PI); // 3.14159 // Can't re-initialize const PI = 4; console.log(PI); // 3.14159 // Can't re-declare var PI = 4; console.log(PI); // 3.14159 © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
11.
var name =
"Eyal"; var age = 43; var user = { 'name': name, 'age': age }; var name = "Eyal"; var age = 43; var user = { name, age }; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
12.
function Person(name, age){
this.name = name; this.age = age; } Person.prototype.sayName = function(){ alert(this.name); }; Person.prototype.getOlder = function(years){ this.age += years; }; function Person(name, age){ this.name = name; this.age = age; } Person.prototype = { sayName(){ © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com alert(this.name); }, getOlder (years){ this.age += years; } };
13.
function equinox2() {
return { date: 20, month: "March", year: 2013, time: { hour: 11, minute: 2 } }; } var { date: d, month: m, time : { hour: h} } = equinox2(); // 20 March at 11 console.log(d + “ ” + m + " at " + h); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
14.
var [start, end]
= ["earth", "moon"] // initialize console.log(start + " => " + end); // earth => moon [start, end] = [end, start] // swapping console.log(start + " => " + end); // moon => earth function equinox() { return [20, "March", 2013, 11, 02]; } var [date, month, , ,] = equinox(); console.log( date +" "+ month); // 20 March © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
15.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
16.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
17.
function history( lang
= "C", year = 1972 ) { return lang + " was created around the year " + year; } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
18.
// defining rest
parameters with 3 dot syntax function push(array, ...items) { items.forEach(function(item) { array.push(item); console.log( item ); }); } // 1 fixed + 3 variable parameters var planets = []; push(planets, "Mercury", "Venus", "Earth"); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
19.
// Spread operator
"...weblink" function createURL (comment, path, protocol, subdomain, domain, tld) { // ... } var weblink = ["ht/w/abc.html", "http", "info", "cern", "ch"], comment = "World's first Website"; createURL( comment, ...weblink ); Spread operator © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
20.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
21.
var f= x
=> x; var f= (n1,n2) => n1+n2; var f= id => ({id:id,name:"T"}); var f = function(x) { © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com return x; } var f = function(n1,n2) { return n1 + n2; } var f = function(id) { return { id: id, name: "T" }; }
22.
var PageHandler =
{ id: "123456", init: function() { document.addEventListener("click", function(event) { this.doSomething(event.type); // error }, false); }, Global doSomething: function(type) { console.log("Handling " + type + " for " + this.id); } }; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
23.
var PageHandler =
{ id: "123456", init: function() { document.addEventListener("click", (function(event) { this.doSomething(event.type); }).bind(this), false); }, doSomething: function(type) { console.log("Handling " + type + " for " + this.id); } } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
24.
var PageHandler =
{ id: "123456", init: function() { document.addEventListener("click", event => this.doSomething(event.type), false); }, doSomething: function(type) { console.log("Handling "+type+" for " + this.id); } }; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
25.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
26.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
27.
class Answer(){ constructor(value){
this._val = value; } get(){ return this._val; } } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
28.
class Person {
constructor(name, age){ public name = name; public age = age; } sayName(){ alert(this.name); } getOlder(years){ this.age += years; } } function Person(name, age){ this.name = name; this.age = age; } Person.prototype.sayName = function(){ alert(this.name); }; Person.prototype.getOlder = function(years){ this.age += years; }; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
29.
class Person {
constructor(name, age){ public name = name; private age = age; } sayName(){ alert(this.name); } getOlder(years){ private(this).age+= years; } } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
30.
class Person {
constructor(name, age){ private innerTitle = ""; // getter and setter for title property. get title() { return innerTitle; } set title(value){ innerTitle = value; } } } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
31.
class Answer{ constructor(value){
this._val = value; } get(){ return this._val; } } class FirmAnswer extends Answer { constructor(value){ super(value); } get(){ return super() + "!!"; } } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
32.
class Answer{ constructor(value){
this._val = value; } get(){ return this._val; } } class FirmAnswer extends Answer { constructor(value){ super(value); } get(){ return super() + "!!"; } } // ES 5.0 function FirmAnswer(name, age){ Answer.call(this, name, age); } FirmAnswer.prototype = new Answer(); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
33.
var base =
{ sayName : function(){ alert(this.name); }, getOlder: function(years){ this.age += years; } }; class Employee prototype base { constructor(name, age){ public name = name; public age = age; } } Employee.prototype = Object.create(base.prototype); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
34.
class Answer{ constructor(value){
this._val = value; } get(){ return this._val; } } class FirmAnswer prototype Answer { constructor(value){ super(value); } get(){ return super() + "!!"; } } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
35.
function Answer(value) {
this._val = value; } Answer.prototype.get = function fn1() { return this._val; }; // Derive class function FirmAnswer(value) { Answer.call(this, value); } FirmAnswer.prototype = Object.create(Answer.prototype); FirmAnswer.prototype.constructor = FirmAnswer; FirmAnswer.prototype.get = function fn2() { return Answer.prototype.get.call(this) + "!!"; }; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
36.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
37.
var engines =
new Set(); // create new Set engines.add("Webkit"); engines.add("Hippo"); engines.add("Hippo"); // note that Hippo is added twice console.log(engines.has("Hippo")); // true console.log(engines.has("Indigo")); // false engines.delete("Hippo"); // delete item console.log(engines.has("Hippo")); // false © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
38.
var es6 =
new Map(); // create new Map es6.set(262, "standard"); // key is number es6.set(undefined, "nah"); // key is undefined var hello = function () { console.log("hello"); }; es6.set(hello, "Hello ES6!"); // key is function console.log( es6.has("edition")); // true © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
39.
var key =
{}, map = new WeakMap(); map.set(key, "Hello!"); // Dereference the key so the value is also removed key = null; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
40.
Array = [
value for each ( variable in values ) condition ]; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
41.
//original array var
numbers = [0,1,2,3,4,5,6,7,8,9,10]; //just copy all items into a new array var duplicate = [i for each (i in numbers)]; //get just the even numbers var evens = [i for each (i in numbers) if (i % 2 == 0)]; //multiply every value by 2 var doubled = [i*2 for each (i in numbers)]; //multiply every odd number by 3 var tripledOdds = [ i*3 for each (i in numbers) if ( i % 2 > 0 ) ]; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
42.
var Size =
new StructType( { width: uint32, height: uint32 }); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com uint8 , uint16 , uint32 int8 , int16 , int32 float32, float64
43.
var Size =
new StructType({width:uint32, height:uint32 }); var SizeArray = new ArrayType(Size, 2); Array Type © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com Array Size
44.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
45.
let arr =
[ "blue", "green" ]; arr.notAnIndex = 123; Array.prototype.protoProp = 456; for (k in arr) console.log(k); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com Print: > 0 > 1 > notAnIndex > protoProp
46.
var colors =
new Set(['rojo', 'amarillo', 'azul']); colors.language = 'es'; // add an expando property for (let name in colors) alert(name); // "language" (the property name) for (let word of colors) alert(word); // "rojo", "amarillo", "azul" (the data) © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
47.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
48.
import items from
"@iter"; let obj = { first: "Jane", last: "Doe" }; for ( let [k,v] of items(obj) ) { console.log( k + " = " + v ); } Output: first = Jane last = Doe © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
49.
function Range(low, high){
this.low = low; this.high = high; } Range.prototype.__iterator__ = function () { return new RangeIterator(this); }; 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++; }; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
50.
Function* simpleGenerator(){ yield
"Hello"; yield "World"; for (var i = 0; i < 2; i++) yield i; } var g = simpleGenerator(); print(g.next()); // "Hello" print(g.next()); // "World" print(g.next()); // 0 print(g.next()); // 1 © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
51.
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; }; var range = new Range(3, 5); for (var i in range) print(i); // 3, 4, 5 in sequence © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
52.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
53.
function fibonacci(){ var
fn1 = 1; var fn2 = 1; while (1){ var current = fn2; fn2 = fn1; fn1 = fn1 + current; var reset = yield current; if (reset){ fn1 = 1; fn2 = 1; } } } var fib = fibonacci(); print(fib.next()); // 1 print(fib.next()); // 1 print(fib.next()); // 2 print(fib.send(true)); // 1 print(fib.next()); // 1 print(fib.next()); // 2 © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
54.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
55.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
56.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
57.
module E4D {
//export this stuff export let myobj = {}; export function hello(){ alert("hello"); }; //keep this stuff hidden function goodbye(){ //... } } //import just myobject import myobj from E4D; console.log(myobj); //import everything import * from E4D; console.log(myobj); console.log(hello); //explicitly named imports import {myobj, hello} from E4D; console.log(myobj); console.log(hello); // use module directly console.log(MyModule.hello); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
58.
module MyModule from
"mymodule.js"; import myobject from MyModule; © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com blocking
59.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
60.
var proxy =
Proxy.create( handler ); //create proxy that has a prototype of myObject var proxy = Proxy.create( handler , myObject ); var p = Proxy.create( {} ,{ get: function (target, name){ return 'Hello, '+ name;} }); document.write( p.World ); // print 'Hello, World' © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
61.
var p =
Proxy.create( {} ,{ get: function (target, name){ return 'Hello, '+ name;} }); document.write( p.World ); // print 'Hello, World' © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
62.
Operation Intercepted as
proxy[name] handler.get(proxy, name) proxy[name] = val handler.set(proxy, name, val) name in proxy handler.has(name) delete proxy[name] handler.delete(name) for (var name in proxy) {...} handler.iterate() Object.keys(proxy) handler.keys() © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
63.
getOwnPropertyDescriptor: function(name) ->
PropertyDescriptor | undefined getPropertyDescriptor: function(name) -> PropertyDescriptor | undefined getOwnPropertyNames: function() -> [ string ] getPropertyNames: function() -> [ string ] defineProperty: function(name, propertyDescriptor) -> any delete: function(name) -> boolean fix: function() -> { string: PropertyDescriptor } | undefined © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
64.
// Object.getOwnPropertyDescriptor(proxy, name)
// Object.getPropertyDescriptor(proxy, name) (not in ES5) // Object.getOwnPropertyNames(proxy) // Object.getPropertyNames(proxy) (not in ES5) // Object.defineProperty(proxy,name,pd) // delete proxy.name // Object.{freeze|seal|preventExtensions}(proxy) © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
65.
has: function(name) ->
boolean hasOwn: function(name) -> boolean get: function(receiver, name) -> any set: function(receiver, name, val) -> boolean enumerate: function() -> [string] keys: function() -> [string] © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
66.
function makeSimpleProfiler(target) {
var count = Object.create(null); return Proxy.create( target, { get: function ( receiver , name) { count[name] = (count[name] || 0) + 1; return target[name]; }, stats: function () { return count; } }); } © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
67.
var Stack =
(function() { var stack = [], allowed = ["push", "pop", "length"]; return Proxy.create({ get: function(receiver, name) { if (allowed.indexOf(name) > -1) { if (typeof stack[name] == "function") { return stack[name].bind(stack); } else { return stack[name]; } } else { return undefined; } } }); }); © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
68.
Proxy.createFunction( handler, callTrap,
constructTrap ); // proxy() -> callTrap // new proxy() -> constructTrap | callTrap var fp = Proxy.createFunction({}, callTrap); var o = { name: fp }; o.name(x); // reified as callTrap.apply(o,[x]) © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
69.
© 2014 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
70.
var name =
"Eyal", Expression msg = `Hello, ${name}!`; console.log(msg); // "Hello, Eyal!" © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
71.
// calculation expression
sample var total = 30, msg = `The total is ${total} (${total*1.05} with tax)`; console.log(msg); // "The total is 30 (31.5 with tax)" © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
72.
// HTML escaping
sample url = "http://e4d.com/"; message = query = "Hello & Goodbye"; color = "red"; safehtml`<a href="${url}?q=${query}" onclick= alert(${message}) style="color: ${color}"> ${message} </a>` <a href="http://e4d.com/?q=Hello%20%26%20Goodbye" onclick=alert('Hello x26 Goodbye') style="color: red">Hello & Goodbye</a> url = "javascript:alert(1337)"; color = "expression(alert(1337))"; <a href="#innocuous?q=Hello%20%26%20Goodbye" onclick=alert('Hello x26 Goodbye') style="color: innocuous">Hello & Goodbye</a> © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
73.
http://www.2ality.com/ Kit Cambridge
A Few New Things Coming To JavaScript HARMONY OF DREAMS COME TRUE Harmony specification_drafts © 2014 Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
74.
eyalvardi.wordpress.com © 2014
Eyal Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com