Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

loop for in

let list = ["a", "b", "c"];
// for in
for (let i in list) {
	// i is index
	console.log(i);   // "0", "1", "2",
	console.log(list[i]);   // "a", "b", "c"
}
// for of
for (let i of list) {
	// i is value
	console.log(i);   // "a", "b", "c"
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #loop
ADD COMMENT
Topic
Name
5+2 =