Answers for "how to traverser thorugh array in js"

1

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)
}
Posted by: Guest on February-20-2021
2

how to iterate array in javascript

array = [ 1, 2, 3, 4, 5, 6 ]; 
   //set variable//set the stop count // increment each loop
for (let i = 0; i < array.length ;i++) { 
  
         array[i] //iterate through each index.
   //add the intructions you would like to perform.
    
             // add any method to array[
}
Posted by: Guest on January-17-2020

Code answers related to "how to traverser thorugh array in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language