DEV Community

0 seconds of 7 minutes, 31 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
07:31
 
Harit Himanshu
Harit Himanshu

Posted on

11 7

Everything about for loops in JavaScript?

Learn about the most common ways of using a for loop in JavaScript. In this video we will cover for, for..in, and for..of loops in JavaScript.

Find the code samples at https://gist.github.com/SuperBonsaii/...

You will learn how to iterate on numbers, Strings, Arrays, Set and Objects in JavaScript using for loops

Harit on Twitter: https://twitter.com/harittweets

Subscribe for moe videos on JavaScript with Visualization: https://www.youtube.com/channel/UC0yZ...
Follow bonsaiilabs on Twitter: https://twitter.com/bonsaiilabs
Follow bonsaiilabs on Facebook: https://www.facebook.com/thebonsaiilabs
Visit bonsaiilabs at https://bonsaiilabs.com

Top comments (4)

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

While loops don't get any love in modern JavaScript 😢

Collapse
 
harittweets profile image
Harit Himanshu

Adam, yeah. Personally, I also tend to use map, reduce and filter a lot more since the iteration comes baked in!
I am working on getting the videos on them out in the near future!

Collapse
 
art4coding profile image
Ryan Tao Spencer

Can i use this to iterate over;
An array like object such as;
document.getElementsByClassName('something')[?];

to add an event listener to all nodes?
i tried [*] but it didn't do anything.

Collapse
 
harittweets profile image
Harit Himanshu

Could you please paste the code you have tried and what expected output you are looking for?

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more