JavaScript ES6+ : For Of Loops

Follow me on twitter @jaymanpandya

For Of loops are new in Javascript and can be used to loop on any kind of iterable data except object.

Iterable data are Arrays, String, Map, Set, Generator etc. For Of loop does not loop over other properties of the prototype and other methods. It also allows us to interrupt the loop by using ‘break’ & ‘continue’ commands.

const kidsUsingTheFacilityRightNow = ['Megan', 'Roy', 'James', 'Louis'];
for (const kidUsingTheFacilityRightNow of kidsUsingTheFacilityRightNow) {
if (kidUsingTheFacilityRightNow === 'James') {
continue;
}
console.log(kidUsingTheFacilityRightNow);
}

Peace ✌️

I am an UI designer with a flair for front-end development that makes any brand shine at what they do best. I am right now building amazing products for our clients both Indian and International at Interactive Digital Labs. I am part of the Design and Marketing Teams for Make WordPress and has spoken at local camps on Gutenberg as well as the importance of user experience. I am not intimidated by markup, languages, or tools: HTML to CSS, wireframing to prototyping, JavaScript to agile development, and design programs including Sketch, Adobe XD, Figma, Photoshop, Illustrator, InDesign etc. I love languages, and not just programming either. I speak English, Hindi, Marathi, and Gujarati. When I am not taking courses to improve my skills, I am trying new food, dabbling in filmmaking and photography, and running and cycling. Say hi to me on Twitter here @jaymanpandya.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.