Loops and Arrays in JavaScript

You can use both for and while loops to easily access each element in an array. Let’s take a look at each one. Arrays and for loops for loops are very useful with arrays as you can easily loop through the array. var insects= [“ant”, “ladybird”, “bee”, “grasshopper”]; var len = insects.length; for (var i…

Read More

for Loops in JavaScript

You use for loops when you know how many times you need to repeat the loop. Often you will know how many times you need to repeat an action. Such as: the number of days in the year the number of items in an array the number of students in a class In these instances,…

Read More