var numbers = [1, 2, 3, 4, 5]; _.each(numbers, function(num){ console.log(num); });
var users = [ { name: "John", age: 25 }, { name: "Mary", age: 30 }, { name: "Bob", age: 20 } ]; var ages = []; _.each(users, function(user){ ages.push(user.age); }); console.log(ages); // [25, 30, 20]This code will iterate over the array of user objects and push the age property of each object into a new array. The _.each function is part of the underscore.js library.