1. Home
  2. Javascript
  3. Foreach function
#javascript#loop#array

Loops through an array of items.

var values = [{number:'34'}, {number:'4'}, {number:'67'}];

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