Soumettre la recherche
Mettre en ligne
Iterators & Generators in ECMAScript 6.0
•
Télécharger en tant que PPTX, PDF
•
2 j'aime
•
888 vues
Eyal Vardi
Suivre
Iterators & Generators in ECMAScript 6.0
Lire moins
Lire la suite
Logiciels
Signaler
Partager
Signaler
Partager
1 sur 16
Télécharger maintenant
Recommandé
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Eyal Vardi
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
Eyal Vardi
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Eyal Vardi
Is writing performant code too expensive?
Is writing performant code too expensive?
Tomasz Kowalczewski
Build Lightweight Web Module
Build Lightweight Web Module
Morgan Cheng
Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
Evans Hauser
Recommandé
Scope & Functions in ECMAScript 6.0
Scope & Functions in ECMAScript 6.0
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Objects & Classes in ECMAScript 6.0
Objects & Classes in ECMAScript 6.0
Eyal Vardi
Modules in ECMAScript 6.0
Modules in ECMAScript 6.0
Eyal Vardi
Proxies in ECMAScript 6.0
Proxies in ECMAScript 6.0
Eyal Vardi
Is writing performant code too expensive?
Is writing performant code too expensive?
Tomasz Kowalczewski
Build Lightweight Web Module
Build Lightweight Web Module
Morgan Cheng
Incremental Type Safety in React Apollo
Incremental Type Safety in React Apollo
Evans Hauser
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency Injection
Dzmitry Ivashutsin
Specs Presentation
Specs Presentation
Synesso
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
Ciklum Ukraine
GlueCon 2016 - Threading in JavaScript
GlueCon 2016 - Threading in JavaScript
Jonathan Baker
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
Ke Wei Louis
ES6 patterns in the wild
ES6 patterns in the wild
Joe Morgan
Appengine Java Night #2b
Appengine Java Night #2b
Shinichi Ogawa
Appengine Java Night #2a
Appengine Java Night #2a
Shinichi Ogawa
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Roel Hartman
Integrating React.js with PHP projects
Integrating React.js with PHP projects
Ignacio Martín
ES6 Simplified
ES6 Simplified
Carlos Ble
Creating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with google
Roel Hartman
Introduction to Angular js
Introduction to Angular js
Mustafa Gamal
Bootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and React
VMware Tanzu
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Damien Carbery
My Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API's
Roel Hartman
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project Files
David Wengier
FleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in Clojure
elliando dias
[AngularJS] From Angular to Mobile in 30 minutes
[AngularJS] From Angular to Mobile in 30 minutes
Globant
Angular animate
Angular animate
Yating Chatiron
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
Eyal Vardi
Get Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task Runners
Matt Gifford
Contenu connexe
Tendances
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency Injection
Dzmitry Ivashutsin
Specs Presentation
Specs Presentation
Synesso
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
Ciklum Ukraine
GlueCon 2016 - Threading in JavaScript
GlueCon 2016 - Threading in JavaScript
Jonathan Baker
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
Ke Wei Louis
ES6 patterns in the wild
ES6 patterns in the wild
Joe Morgan
Appengine Java Night #2b
Appengine Java Night #2b
Shinichi Ogawa
Appengine Java Night #2a
Appengine Java Night #2a
Shinichi Ogawa
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Roel Hartman
Integrating React.js with PHP projects
Integrating React.js with PHP projects
Ignacio Martín
ES6 Simplified
ES6 Simplified
Carlos Ble
Creating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with google
Roel Hartman
Introduction to Angular js
Introduction to Angular js
Mustafa Gamal
Bootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and React
VMware Tanzu
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Damien Carbery
My Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API's
Roel Hartman
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project Files
David Wengier
FleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in Clojure
elliando dias
[AngularJS] From Angular to Mobile in 30 minutes
[AngularJS] From Angular to Mobile in 30 minutes
Globant
Angular animate
Angular animate
Yating Chatiron
Tendances
(20)
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency Injection
Specs Presentation
Specs Presentation
CiklumJavaSat_15112011:Alex Kruk VMForce
CiklumJavaSat_15112011:Alex Kruk VMForce
GlueCon 2016 - Threading in JavaScript
GlueCon 2016 - Threading in JavaScript
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
2014_07_28_Django環境安裝以及 Django Book Chapter 4: Templates
ES6 patterns in the wild
ES6 patterns in the wild
Appengine Java Night #2b
Appengine Java Night #2b
Appengine Java Night #2a
Appengine Java Night #2a
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Developing A Real World Logistic Application With Oracle Application - UKOUG ...
Integrating React.js with PHP projects
Integrating React.js with PHP projects
ES6 Simplified
ES6 Simplified
Creating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with google
Introduction to Angular js
Introduction to Angular js
Bootiful Development with Spring Boot and React
Bootiful Development with Spring Boot and React
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
Demystifying Hooks, Actions & Filters - WordCamp Belfast 2018
My Top 5 APEX JavaScript API's
My Top 5 APEX JavaScript API's
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project Files
FleetDB A Schema-Free Database in Clojure
FleetDB A Schema-Free Database in Clojure
[AngularJS] From Angular to Mobile in 30 minutes
[AngularJS] From Angular to Mobile in 30 minutes
Angular animate
Angular animate
En vedette
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
Eyal Vardi
Get Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task Runners
Matt Gifford
Future of JavaScript
Future of JavaScript
Eyal Vardi
What’s new in ECMAScript 6.0
What’s new in ECMAScript 6.0
Eyal Vardi
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Eyal Vardi
Node js overview
Node js overview
Eyal Vardi
For Rent Lease - 1300sq.ft Ground Floor Showroom on Rent-Lease at Vastrapur ...
For Rent Lease - 1300sq.ft Ground Floor Showroom on Rent-Lease at Vastrapur ...
Vikas25185
OOP in JavaScript
OOP in JavaScript
Eyal Vardi
AngulrJS Overview
AngulrJS Overview
Eyal Vardi
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
En vedette
(10)
Symbols in ECMAScript 6.0
Symbols in ECMAScript 6.0
Get Grulping with JavaScript Task Runners
Get Grulping with JavaScript Task Runners
Future of JavaScript
Future of JavaScript
What’s new in ECMAScript 6.0
What’s new in ECMAScript 6.0
Async & Parallel in JavaScript
Async & Parallel in JavaScript
Node js overview
Node js overview
For Rent Lease - 1300sq.ft Ground Floor Showroom on Rent-Lease at Vastrapur ...
For Rent Lease - 1300sq.ft Ground Floor Showroom on Rent-Lease at Vastrapur ...
OOP in JavaScript
OOP in JavaScript
AngulrJS Overview
AngulrJS Overview
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Similaire à Iterators & Generators in ECMAScript 6.0
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Eyal Vardi
Node.js Event Emitter
Node.js Event Emitter
Eyal Vardi
ES2015 New Features
ES2015 New Features
Giacomo Zinetti
Savitch ch 022
Savitch ch 022
Dr .Ahmed Tawwab
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
tdc-globalcode
TDC2016SP - Trilha .NET
TDC2016SP - Trilha .NET
tdc-globalcode
Writing Good Tests
Writing Good Tests
Matteo Baglini
Como NÃO testar o seu projeto de Software. DevDay 2014
Como NÃO testar o seu projeto de Software. DevDay 2014
alexandre freire
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Dror Helper
Web api crud operations
Web api crud operations
Eyal Vardi
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
David Wengier
JavaScript for PHP developers
JavaScript for PHP developers
Stoyan Stefanov
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & Extensibility
Eyal Vardi
Dependency Injection
Dependency Injection
Indrit Selimi
Programação reativa e o actor model
Programação reativa e o actor model
Fabrício Rissetto
Bad test, good test
Bad test, good test
Seb Rose
Rust
Rust
Chih-Hsuan Kuo
Integrating Erlang and Java
Integrating Erlang and Java
Dennis Byrne
Java Script Workshop
Java Script Workshop
Dmitry Baranovskiy
From typing the test to testing the type
From typing the test to testing the type
Wim Godden
Similaire à Iterators & Generators in ECMAScript 6.0
(20)
Triggers, actions & behaviors in XAML
Triggers, actions & behaviors in XAML
Node.js Event Emitter
Node.js Event Emitter
ES2015 New Features
ES2015 New Features
Savitch ch 022
Savitch ch 022
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016POA | Trilha .NET - CQRS e ES na prática com RavenDB
TDC2016SP - Trilha .NET
TDC2016SP - Trilha .NET
Writing Good Tests
Writing Good Tests
Como NÃO testar o seu projeto de Software. DevDay 2014
Como NÃO testar o seu projeto de Software. DevDay 2014
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
Web api crud operations
Web api crud operations
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
JavaScript for PHP developers
JavaScript for PHP developers
Asp.Net Mvc Internals & Extensibility
Asp.Net Mvc Internals & Extensibility
Dependency Injection
Dependency Injection
Programação reativa e o actor model
Programação reativa e o actor model
Bad test, good test
Bad test, good test
Rust
Rust
Integrating Erlang and Java
Integrating Erlang and Java
Java Script Workshop
Java Script Workshop
From typing the test to testing the type
From typing the test to testing the type
Plus 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
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
AngularJS Internal
AngularJS Internal
Eyal Vardi
Plus de Eyal Vardi
(20)
Why magic
Why magic
Smart Contract
Smart Contract
Rachel's grandmother's recipes
Rachel's grandmother's recipes
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
AngularJS Internal
AngularJS Internal
Dernier
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
masabamasaba
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
masabamasaba
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
masabamasaba
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
Shane Coughlan
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
WSO2
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
WSO2
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
masabamasaba
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
masabamasaba
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
Presentation.STUDIO
Direct Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension Aid
Philip Schwarz
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Jim McKeeth
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
Juha-Pekka Tolvanen
Dernier
(20)
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
Direct Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension Aid
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
Iterators & Generators in ECMAScript 6.0
1.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
2.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com foreach (object obj in list) { DoSomething(obj); } Enumerator e = list.GetEnumerator(); while (e.MoveNext()) { object obj = e.Current; DoSomething(obj); } public interface IEnumerable{ IEnumerator GetEnumerator(); } public interface IEnumerator{ object Current {get;} bool MoveNext(); void Reset(); }
3.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com class Range{ constructor(low, high){ this.low = low; this.high = high; } [Symbol.iterator](){ return new RangeIterator(this); } } class RangeIterator{ constructor(range){ this.range = Range; this.current = this.range.low; } next(){ if( this.current > this.range.high ){ return { value : undefined, done : true }; } else { return { value : this.current++, done : false }; } } } for( let i of new Range(1, 3) ) { console.log(i); } // Like IEnumerable in C# // Like IEnumerator in C# // Like foreach in C#
4.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com var colors = new Set(['rojo', 'amarillo', 'azul']); for (let word of colors){ alert(word); // "rojo", "amarillo", "azul" (the data) }
5.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com let arr = [ "blue", "green" ]; arr.notAnIndex = 123; Array.prototype.protoProp = 456; for (let k in arr) { console.log(k); } Print: > 0 > 1 > notAnIndex > protoProp
6.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com
7.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com public class Test { public IEnumerator GetEnumerator() { yield return "Hello"; yield return "World"; } }
8.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com public class Test { public IEnumerator GetEnumerator() { return new __Enumerator(this); } } private class __Enumerator : IEnumerator{ object current; int state; public bool MoveNext() { switch (state) { case 0: current = "Hello"; state = 1; return true; case 1: current = "World"; state = 2; return true; default: return false; } } public object Current { get { return current; } } }
9.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com 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
10.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com class Range{ constructor(low, high){ this.low = low; this.high = high; } *[Symbol.iterator](){ for (let i = this.low; i <= this.high; i++) { yield i; } } } for (var i in new Range(3, 5) ) { print(i); // 3, 4, 5 in sequence } // Like IEnumerable in C#
11.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com function* g1() { yield 2; yield 3; } function* g2() { yield 1; yield* g1(); yield 4; } var iterator = g2(); console.log( iterator.next().value ); // 1 console.log( iterator.next().value ); // 2 console.log( iterator.next().value ); // 3 console.log( iterator.next().value ); // 4
12.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com function* longRunningTask() { let result1 = yield* step1(); yield; let result2 = yield* step2(); yield; yield* step3(result1, result2); } function* step1() { ... return result1; } function* step2() { ... return result2; } function* step3(p1, p2) { ... }
13.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com function* fibonacci() { let [prev, curr] = [0, 1]; for (;;) { [prev, curr] = [curr, prev + curr]; yield curr; } } for (n of fibonacci()) { // truncate the sequence at 1000 if (n > 1000) break; print(n); }
14.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com link let items = [1, 2, 3, 4, 5, 6] .asEnumerable() .where(x => x % 2) .select(x => x + 1); for (let item in items) { console.log(item); } //output will be 2, 4, 6
15.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com http://www.2ality.com/ Understanding ECMAScript 6 http://ecmascript6.org/ A Few New Things Coming To JavaScript HARMONY OF DREAMS COME TRUE Harmony specification_drafts
16.
© 2015 Eyal
Vardi. All rights reserved. Tel: 054-5-767-300, Email: evardi@gmail.com eyalvardi.wordpress.com
Télécharger maintenant