javascript forEach

Iterate over array elements:


var customArray = [3, 5, 7];

customArray.forEach(function(val, index) {

    console.log(val); // 3, 5, 7

});

Iterate over object keys and properties:


var customObject = {'a': 3, 'b': 5, 'c': 7};

Object.keys(customObject).forEach(function(val, index) {

    console.log(val); // a, b, c

    console.log(customObject[val]); // 3, 5, 7

});