Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

for each array javascript

var fruits = ["apple", "orange", "cherry"];
fruits.forEach(getArrayValues);

function getArrayValues(item, index) {
  console.log( index + ":" + item);
}
/*
result:
0:apple
1:orange
2:cherry
*/
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #array #javascript
ADD COMMENT
Topic
Name
7+2 =