Iterable protocol in ES6

Strings, Array, Sets, Maps are examples of built-in iterable’s

let digits=[1,2,3,4,5,6];
let name=”I am Nuwan”;

for(const digit of digits){ console.info(digit); }

for(const e of name){ console.info(e); }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s