Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to use foreach in javascript

var array = ["a","b","c"];
// example 1
  for(var value of array){
    console.log(value);
    value += 1;
  }

// example 2
  array.forEach((item, index)=>{
    console.log(index, item)
  })
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #foreach #javascript
ADD COMMENT
Topic
Name
5+1 =