July 2011
Intermediate to advanced
276 pages
5h 11m
English
The contents of an OBJECT differ from those of an ARRAY. Unlike an array, the keys are not incrementing integers. The values in an object have keys that may be strings or integers or even functions.
Create an object like a hash over which to iterate. Though objects may contain functions, only create string and integer elements for this recipe.
var my_object = {
'one':'one',
'two':2,
3:'Trinity'
};
The iteration of an OBJECT varies from that of an ARRAY in two ways. The first is that the Object.each() class method must be used to begin the iteration, as opposed to iterating using dot concatenation syntax directly as is possible with an ARRAY. Secondly, the ...