Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Different between for of loop and for in loop in js

let list = [10, 11, 12];

for (let i in list) {
   console.log(i); //Display the indices: "0", "1", "2",
}

for (let i of list) {
   console.log(i); // Display the elements: "10", "11", "12"
}
 
PREVIOUS NEXT
Tagged: #Different #loop #loop #js
ADD COMMENT
Topic
Name
6+6 =