traverse an array code example
Example: traverse an array in javascript
//Method 1 using for loop
let array = [ 1, 2, 3, 4, 5, 6 ];
for (let index = 0; index < array.length; index++) {
console.log(array[index]);
}
//Method 2 using for Of loop
for (let traverse of array ){
console.log(traverse)
}