Reputation: 15702
Given the following JavaScript data structure - how would you describe it?
BLA = {
date : 12345678,
layers : {
bottom : "bottomLayer"
},
numbers : [5,4,2,2,4],
start : function(){}
}
I would say the following about above data structure, do you agree?
It is an object literal called
BLA
.BLA
is initializted with 4 object members. The first one isdate
which value is12345678
and the second one is the memberlayers
which recursively stores an literal itself:bottom:"bottomLayer"
. The third member is referenced asnumbers
which holds an array with 5 values. The last member is referenced asstart
and its respective value is an anomyous function.
Upvotes: 1
Views: 195
Reputation: 270609
You're right on track, except for this part which reads a little awkwardly:
second one is the member “layers” which recursively stores an literal itself: 'bottom:”bottomLayer”'
Instead I would just describe it as an object literal itself:
second one is the member “layers” which is an object literal containing the string property: 'bottom' whose value is ”bottomLayer”
layers
is not really doing anything recursive; that's not quite the appropriate term. But you clearly understand what the object is.
Upvotes: 3