Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Iterating or loop through the elements of an array is with a for loop (for):

var keys = Object.keys(o);   // Get an array of property names for object o
var values = []              // Store matching property values in this array
for(var i = 0; i < keys.length; i++) {  // For each index in the array
    var key = keys[i];                  // Get the key at that index
    values[i] = o[key];                 // Store the value in the values array
}
Source by www.oreilly.com #
 
PREVIOUS NEXT
Tagged: #Iterating #loop #elements #array #loop
ADD COMMENT
Topic
Name
1+7 =