java scirpt loops code example
Example 1: for loop
for(int i = 0; i < some_number; i++){
//inside loop do whatever you want
}
Example 2: for in loop javascript
let array = [1,2,3,4,5,6,7,8,9,10];
// our array that we will use the for loop on
for (let i = 0; i < array.length; i++) {
// this loop will console log the element at array[i] starting at 0
// and will continue looping for i < array.length
console.log(array[i]);
// after each loop i will increase by 1
}
// this will console log
// 1
// 2
// 3
// 4
// 5
// 6
// 7
// 8
// 9
// 10