Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)
}
 
PREVIOUS NEXT
Tagged: #traverse #array #javascript
ADD COMMENT
Topic
Name
4+1 =