+ 4

Might be a stupid question, but v what is the main purpose for looping in JS?

16th May 2017, 3:57 PM
Kevin
Kevin - avatar
3 Réponses
+ 8
loops are usefull, if you want to run the same code over and over again, with a different value for each Iteration. with a loop you can iterate through an array and printout every value! or compare 2 Arrays to find Same values
16th May 2017, 4:14 PM
Cubensis
Cubensis - avatar
+ 3
A lots of purpose for using looping eg. ‱ prints all the array values ‱ check all same elements status ‱ update elements values ‱ add events listeners to all buttons ‱ iterate a list to find some text etc...
16th May 2017, 5:00 PM
CalviŐČ
CalviŐČ - avatar
+ 1
Thank you guys! I see now
16th May 2017, 5:33 PM
Kevin
Kevin - avatar