1. Home
  2. Javascript
  3. Foreach function

Loops through an array of items.

#javascript#loop#array
var values = [{number:'34'}, {number:'4'}, {number:'67'}];

values.forEach(function(num){
    console.log(num.number); // 34, 4, 67
});
copy
Full Javascript cheatsheet