array?
array?
Out of context: Reply #4
- Started
- Last post
- 7 Responses
- enjine0
items is the array
(it's declared with the two straight brackets which are the outtermost characters)the numbered elements 0, 1, ... are the indexes of the array
the indexes, in this example are referring to what is called unnamed Objects. The curly braces declare that it is an object that is being instantiated, sans object name, and the items in the curly braces-- id:'selection'-- are the propery/value pairs.
declaring an unnamed Object like that is the same thing as saying
var obj = new Object();
obj.id = "selection";
obj.label = "Selection";
obj.xPos = "0"etc...
but you can't refer to an unnamed Object after it is created unless it is stored somewhere, hence the need for the 'items' array.