JavaScript wrangler.
Check out my books!
Web API Cookbook:
https://www.amazon.com/Web-API-Cookbook-JavaScript-Applications/dp/1098150694
Modern CSS:
https://www.amazon.com/dp/148426293X
There are still perfectly valid use cases for the for loop. For example, if you want to break out of the loop early there’s the break keyword.
Or if you want to not iterate over the items of an array, but rather just repeat something a certain number of times, a for loop is useful there too.
A for loop also lets you have more complex logic for when you should continue looping. Remember that for loops are not only used for iterating over an array.
There are still perfectly valid use cases for the for loop. For example, if you want to break out of the loop early there’s the break keyword.
Or if you want to not iterate over the items of an array, but rather just repeat something a certain number of times, a for loop is useful there too.
A for loop also lets you have more complex logic for when you should continue looping. Remember that for loops are not only used for iterating over an array.
Aggred