SlideShare a Scribd company logo
Iterators | ES6
JAGADEESH PATTA ( PJ )
Agenda
 Introduction Iterators
 Iterator on Array
 Iterator on Set
 Iterator on Object
 Live Examples
Introduction
 An object is consider like an iterable when it has an implementation for
Symbol.iterator property.
 When an object contains Symbol.iterator implementation than the object
allows us to use in for…of on it.
 Array, Map, Set and String have their Symbol.iterator property already
implemented.
Iterator on Array
 An array has its own iterator function implementation.
Example
var arr_one = [ 1, 2, 3, 4, 5 ];
for ( let element of arr_one){
console.log ( arr_one [ element ] );
}
Iterator on Set
 An set has its own iterator function implementation.
Example
var set_one = ( [ 1, 2, 3, 4, 5 ] );
for ( let element of set_one){
console.log ( set_one [ element ] );
}
Iterator on Object
 An object doesn’t have its own iterator function implementation. If we want to
apply for…of on object we need to implement Symbol.iterator.
Example
var obj = {
“name” : “PJ”, “designation” : “SSE”
}
Iterator on Object (cont…)
Custom Iterator
obj [ Symbol.iterator ] = function( ) {
let keys = Object.keys (obj), count = 0, isDone = false;
let next = ( ) => {
if ( count >= keys.length ) { isDone = true }
return { done : isDone, value : obj [ keys [ count++ ] ] };
} return { next };
}
Iterator on Object (cont…)
Custom Iterator
for ( let property of obj ) {
console.log ( obj [ property ] );
}
// PJ, SSE
Any Q ?
Thank You

More Related Content

What's hot (20)

An adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsAn adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate records
Likan Patra
 
haskell_fp1
haskell_fp1haskell_fp1
haskell_fp1
Sambaiah Kilaru
 
Python for lab_folk
Python for lab_folkPython for lab_folk
Python for lab_folk
Anneke Batenburg
 
Scala Collections : Java 8 on Steroids
Scala Collections : Java 8 on SteroidsScala Collections : Java 8 on Steroids
Scala Collections : Java 8 on Steroids
François Garillot
 
Chapter 7 String
Chapter 7 StringChapter 7 String
Chapter 7 String
OUM SAOKOSAL
 
FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.
FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.
FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.
Meghaj Mallick
 
IRJET- Soft Hyperfilters in Hyperlattices
IRJET- Soft Hyperfilters in HyperlatticesIRJET- Soft Hyperfilters in Hyperlattices
IRJET- Soft Hyperfilters in Hyperlattices
IRJET Journal
 
Scipy, numpy and friends
Scipy, numpy and friendsScipy, numpy and friends
Scipy, numpy and friends
Michele Mattioni
 
Chapter 17 Tuples
Chapter 17 TuplesChapter 17 Tuples
Chapter 17 Tuples
Praveen M Jigajinni
 
Heapsort
HeapsortHeapsort
Heapsort
zafarali5454
 
Arrays Java
Arrays JavaArrays Java
Arrays Java
Jose Sumba
 
Introduction to Loc
Introduction to LocIntroduction to Loc
Introduction to Loc
Ider Zheng
 
CDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - IntroductionCDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - Introduction
Arulalan T
 
L13 string handling(string class)
L13 string handling(string class)L13 string handling(string class)
L13 string handling(string class)
teach4uin
 
Ms Ajax Array Extensions
Ms Ajax Array ExtensionsMs Ajax Array Extensions
Ms Ajax Array Extensions
jason hu 金良胡
 
lecture 5
lecture 5lecture 5
lecture 5
sajinsc
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
KristinaBorooah
 
Array of pointer
Array of pointerArray of pointer
Array of pointer
fasalsial1fasalsial1
 
Lecture 7- Iterator and for loop over arrays
Lecture 7- Iterator and for loop over arraysLecture 7- Iterator and for loop over arrays
Lecture 7- Iterator and for loop over arrays
Syed Afaq Shah MACS CP
 
Stack Data structure
Stack Data structureStack Data structure
Stack Data structure
B Liyanage Asanka
 
An adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsAn adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate records
Likan Patra
 
Scala Collections : Java 8 on Steroids
Scala Collections : Java 8 on SteroidsScala Collections : Java 8 on Steroids
Scala Collections : Java 8 on Steroids
François Garillot
 
FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.
FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.
FSTREAM,ASSERT LIBRARY & CTYPE LIBRARY.
Meghaj Mallick
 
IRJET- Soft Hyperfilters in Hyperlattices
IRJET- Soft Hyperfilters in HyperlatticesIRJET- Soft Hyperfilters in Hyperlattices
IRJET- Soft Hyperfilters in Hyperlattices
IRJET Journal
 
Introduction to Loc
Introduction to LocIntroduction to Loc
Introduction to Loc
Ider Zheng
 
CDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - IntroductionCDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - Introduction
Arulalan T
 
L13 string handling(string class)
L13 string handling(string class)L13 string handling(string class)
L13 string handling(string class)
teach4uin
 
lecture 5
lecture 5lecture 5
lecture 5
sajinsc
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
KristinaBorooah
 
Lecture 7- Iterator and for loop over arrays
Lecture 7- Iterator and for loop over arraysLecture 7- Iterator and for loop over arrays
Lecture 7- Iterator and for loop over arrays
Syed Afaq Shah MACS CP
 

Similar to 11. Iterators | ES6 | JavaScript | TypeScript (20)

Iterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khuranaIterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khurana
Gaurav Khurana
 
Iterables and Iterators in JavaScript
Iterables and Iterators in JavaScriptIterables and Iterators in JavaScript
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
hesher
 
ECMAScript 2015: my favourite parts
ECMAScript 2015: my favourite partsECMAScript 2015: my favourite parts
ECMAScript 2015: my favourite parts
André Duarte
 
Es6 day2
Es6 day2Es6 day2
Es6 day2
Abhishek Sharma
 
JavaScript Iteration Protocols - Workshop NodeConf EU 2022
JavaScript Iteration Protocols - Workshop NodeConf EU 2022JavaScript Iteration Protocols - Workshop NodeConf EU 2022
JavaScript Iteration Protocols - Workshop NodeConf EU 2022
Luciano Mammino
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
Manoj Kumar
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016
Manoj Kumar
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
偉格 高
 
ES6
ES6ES6
ES6
Ofir's Fridman
 
Javascript: repetita iuvant
Javascript: repetita iuvantJavascript: repetita iuvant
Javascript: repetita iuvant
Luciano Mammino
 
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
Igalia
 
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Eyal Vardi
 
Internal workshop es6_2015
Internal workshop es6_2015Internal workshop es6_2015
Internal workshop es6_2015
Miguel Ruiz Rodriguez
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
Eduard Tomàs
 
ES6: Features + Rails
ES6: Features + RailsES6: Features + Rails
ES6: Features + Rails
Santosh Wadghule
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
Binary Studio
 
Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6Workshop 10: ECMAScript 6
Workshop 10: ECMAScript 6
Visual Engineering
 
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
Shift Conference
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
Sperasoft
 
Iterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khuranaIterable, iterator, generator by gaurav khurana
Iterable, iterator, generator by gaurav khurana
Gaurav Khurana
 
Iterables and Iterators in JavaScript
Iterables and Iterators in JavaScriptIterables and Iterators in JavaScript
Iterables and Iterators in JavaScript
Ideas2IT Technologies
 
ES2015 (ES6) Overview
ES2015 (ES6) OverviewES2015 (ES6) Overview
ES2015 (ES6) Overview
hesher
 
ECMAScript 2015: my favourite parts
ECMAScript 2015: my favourite partsECMAScript 2015: my favourite parts
ECMAScript 2015: my favourite parts
André Duarte
 
JavaScript Iteration Protocols - Workshop NodeConf EU 2022
JavaScript Iteration Protocols - Workshop NodeConf EU 2022JavaScript Iteration Protocols - Workshop NodeConf EU 2022
JavaScript Iteration Protocols - Workshop NodeConf EU 2022
Luciano Mammino
 
ES6 PPT FOR 2016
ES6 PPT FOR 2016ES6 PPT FOR 2016
ES6 PPT FOR 2016
Manoj Kumar
 
Javascript: repetita iuvant
Javascript: repetita iuvantJavascript: repetita iuvant
Javascript: repetita iuvant
Luciano Mammino
 
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
function* - ES6, generators, and all that (JSRomandie meetup, February 2014)
Igalia
 
Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0Iterators & Generators in ECMAScript 6.0
Iterators & Generators in ECMAScript 6.0
Eyal Vardi
 
EcmaScript unchained
EcmaScript unchainedEcmaScript unchained
EcmaScript unchained
Eduard Tomàs
 
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
A, B, C. 1, 2, 3. Iterables you and me - Willian Martins (ebay)
Shift Conference
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
Sperasoft
 
Ad

More from pcnmtutorials (18)

12. Map | WeakMap | ES6 | JavaScript | Typescript
12. Map | WeakMap | ES6 | JavaScript | Typescript12. Map | WeakMap | ES6 | JavaScript | Typescript
12. Map | WeakMap | ES6 | JavaScript | Typescript
pcnmtutorials
 
10. symbols | ES6 | JavaScript | TypeScript
10. symbols | ES6 | JavaScript | TypeScript10. symbols | ES6 | JavaScript | TypeScript
10. symbols | ES6 | JavaScript | TypeScript
pcnmtutorials
 
9. ES6 | Let And Const | TypeScript | JavaScript
9. ES6 | Let And Const | TypeScript | JavaScript9. ES6 | Let And Const | TypeScript | JavaScript
9. ES6 | Let And Const | TypeScript | JavaScript
pcnmtutorials
 
8. Spread Syntax | ES6 | JavaScript
8. Spread Syntax | ES6 | JavaScript8. Spread Syntax | ES6 | JavaScript
8. Spread Syntax | ES6 | JavaScript
pcnmtutorials
 
7. Rest parameters | ES6 | JavaScript
7. Rest parameters | ES6 | JavaScript7. Rest parameters | ES6 | JavaScript
7. Rest parameters | ES6 | JavaScript
pcnmtutorials
 
6. Default parameters | ES6 | JavaScript
6. Default parameters | ES6 | JavaScript6. Default parameters | ES6 | JavaScript
6. Default parameters | ES6 | JavaScript
pcnmtutorials
 
5. Destructuring | ES6 | Assignment
5. Destructuring | ES6 | Assignment 5. Destructuring | ES6 | Assignment
5. Destructuring | ES6 | Assignment
pcnmtutorials
 
4. Template strings | ES6
4. Template strings | ES64. Template strings | ES6
4. Template strings | ES6
pcnmtutorials
 
3. Object literals | ES6 | JSON
3. Object literals | ES6 | JSON3. Object literals | ES6 | JSON
3. Object literals | ES6 | JSON
pcnmtutorials
 
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
pcnmtutorials
 
1. Arrow Functions | JavaScript | ES6
1. Arrow Functions | JavaScript | ES61. Arrow Functions | JavaScript | ES6
1. Arrow Functions | JavaScript | ES6
pcnmtutorials
 
Decorators | TypeScript | Angular2 Decorators
Decorators | TypeScript | Angular2 DecoratorsDecorators | TypeScript | Angular2 Decorators
Decorators | TypeScript | Angular2 Decorators
pcnmtutorials
 
Web workers | JavaScript | HTML API
Web workers | JavaScript | HTML APIWeb workers | JavaScript | HTML API
Web workers | JavaScript | HTML API
pcnmtutorials
 
Declaration merging | Typescript
Declaration merging | TypescriptDeclaration merging | Typescript
Declaration merging | Typescript
pcnmtutorials
 
Module resolution | Typescript
Module resolution | TypescriptModule resolution | Typescript
Module resolution | Typescript
pcnmtutorials
 
Material design in android L developer Preview
Material design in android L developer PreviewMaterial design in android L developer Preview
Material design in android L developer Preview
pcnmtutorials
 
data structure, stack, stack data structure
data structure, stack, stack data structuredata structure, stack, stack data structure
data structure, stack, stack data structure
pcnmtutorials
 
1.introduction to data_structures
1.introduction to data_structures1.introduction to data_structures
1.introduction to data_structures
pcnmtutorials
 
12. Map | WeakMap | ES6 | JavaScript | Typescript
12. Map | WeakMap | ES6 | JavaScript | Typescript12. Map | WeakMap | ES6 | JavaScript | Typescript
12. Map | WeakMap | ES6 | JavaScript | Typescript
pcnmtutorials
 
10. symbols | ES6 | JavaScript | TypeScript
10. symbols | ES6 | JavaScript | TypeScript10. symbols | ES6 | JavaScript | TypeScript
10. symbols | ES6 | JavaScript | TypeScript
pcnmtutorials
 
9. ES6 | Let And Const | TypeScript | JavaScript
9. ES6 | Let And Const | TypeScript | JavaScript9. ES6 | Let And Const | TypeScript | JavaScript
9. ES6 | Let And Const | TypeScript | JavaScript
pcnmtutorials
 
8. Spread Syntax | ES6 | JavaScript
8. Spread Syntax | ES6 | JavaScript8. Spread Syntax | ES6 | JavaScript
8. Spread Syntax | ES6 | JavaScript
pcnmtutorials
 
7. Rest parameters | ES6 | JavaScript
7. Rest parameters | ES6 | JavaScript7. Rest parameters | ES6 | JavaScript
7. Rest parameters | ES6 | JavaScript
pcnmtutorials
 
6. Default parameters | ES6 | JavaScript
6. Default parameters | ES6 | JavaScript6. Default parameters | ES6 | JavaScript
6. Default parameters | ES6 | JavaScript
pcnmtutorials
 
5. Destructuring | ES6 | Assignment
5. Destructuring | ES6 | Assignment 5. Destructuring | ES6 | Assignment
5. Destructuring | ES6 | Assignment
pcnmtutorials
 
4. Template strings | ES6
4. Template strings | ES64. Template strings | ES6
4. Template strings | ES6
pcnmtutorials
 
3. Object literals | ES6 | JSON
3. Object literals | ES6 | JSON3. Object literals | ES6 | JSON
3. Object literals | ES6 | JSON
pcnmtutorials
 
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
2. Classes | Object Oriented Programming in JavaScript | ES6 | JavaScript
pcnmtutorials
 
1. Arrow Functions | JavaScript | ES6
1. Arrow Functions | JavaScript | ES61. Arrow Functions | JavaScript | ES6
1. Arrow Functions | JavaScript | ES6
pcnmtutorials
 
Decorators | TypeScript | Angular2 Decorators
Decorators | TypeScript | Angular2 DecoratorsDecorators | TypeScript | Angular2 Decorators
Decorators | TypeScript | Angular2 Decorators
pcnmtutorials
 
Web workers | JavaScript | HTML API
Web workers | JavaScript | HTML APIWeb workers | JavaScript | HTML API
Web workers | JavaScript | HTML API
pcnmtutorials
 
Declaration merging | Typescript
Declaration merging | TypescriptDeclaration merging | Typescript
Declaration merging | Typescript
pcnmtutorials
 
Module resolution | Typescript
Module resolution | TypescriptModule resolution | Typescript
Module resolution | Typescript
pcnmtutorials
 
Material design in android L developer Preview
Material design in android L developer PreviewMaterial design in android L developer Preview
Material design in android L developer Preview
pcnmtutorials
 
data structure, stack, stack data structure
data structure, stack, stack data structuredata structure, stack, stack data structure
data structure, stack, stack data structure
pcnmtutorials
 
1.introduction to data_structures
1.introduction to data_structures1.introduction to data_structures
1.introduction to data_structures
pcnmtutorials
 
Ad

Recently uploaded (20)

Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FMEEnabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Murdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementaryMurdledescargadarkweb.pdfvolumen1 100 elementary
Murdledescargadarkweb.pdfvolumen1 100 elementary
JorgeSemperteguiMont
 
Enabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FMEEnabling BIM / GIS integrations with Other Systems with FME
Enabling BIM / GIS integrations with Other Systems with FME
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
PyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent IntegrationPyData - Graph Theory for Multi-Agent Integration
PyData - Graph Theory for Multi-Agent Integration
barqawicloud
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureNo-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
Secure Access with Azure Active Directory
Secure Access with Azure Active DirectorySecure Access with Azure Active Directory
Secure Access with Azure Active Directory
VICTOR MAESTRE RAMIREZ
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 

11. Iterators | ES6 | JavaScript | TypeScript

  • 2. Agenda  Introduction Iterators  Iterator on Array  Iterator on Set  Iterator on Object  Live Examples
  • 3. Introduction  An object is consider like an iterable when it has an implementation for Symbol.iterator property.  When an object contains Symbol.iterator implementation than the object allows us to use in for…of on it.  Array, Map, Set and String have their Symbol.iterator property already implemented.
  • 4. Iterator on Array  An array has its own iterator function implementation. Example var arr_one = [ 1, 2, 3, 4, 5 ]; for ( let element of arr_one){ console.log ( arr_one [ element ] ); }
  • 5. Iterator on Set  An set has its own iterator function implementation. Example var set_one = ( [ 1, 2, 3, 4, 5 ] ); for ( let element of set_one){ console.log ( set_one [ element ] ); }
  • 6. Iterator on Object  An object doesn’t have its own iterator function implementation. If we want to apply for…of on object we need to implement Symbol.iterator. Example var obj = { “name” : “PJ”, “designation” : “SSE” }
  • 7. Iterator on Object (cont…) Custom Iterator obj [ Symbol.iterator ] = function( ) { let keys = Object.keys (obj), count = 0, isDone = false; let next = ( ) => { if ( count >= keys.length ) { isDone = true } return { done : isDone, value : obj [ keys [ count++ ] ] }; } return { next }; }
  • 8. Iterator on Object (cont…) Custom Iterator for ( let property of obj ) { console.log ( obj [ property ] ); } // PJ, SSE