for loop kavascript code example
Example 1: loop javascript
for(let i = 0; i < arr.length; i++){
}
Example 2: javascript for loop
for (let count = 0; count < 90; count++) {
}
Example 3: for loop javascript
var i;
for (i = 0; i < 10 ; i++) {
}
Example 4: for loop js
let arr = [];
for(let i = 0; i <= 10; i++){
arr[i] = Math.round(Math.random() * 10);
}
• Result: [3, 1, 1, 2, 3, 9, 5, 6, 6, 8, 5]
• Or
let arr = [];
for(let i = 0; i <= 10; i++){
arr[i] = Math.trunc(Math.random() * 10);
}
Result[7, 6, 0, 2, 4, 8, 7, 5, 5, 6, 5]