Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

for of in js or 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"
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #loop #js
ADD COMMENT
Topic
Name
1+4 =