loop on array for of code example
Example 1: for in and for of in js
const iterable = [10, 20, 30];
for (const value of iterable) {
console.log("fef"+value);
}
// 10
// 20
// 30
Example 2: use these instead of a for loop javascript
const array = [1,2,3,4,5];const evenNumbers = array.filter(function(elem) { // expressions that return 'true' are retained return elem % 2 == 0;});