1

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 is date which value is 12345678 and the second one is the member layers which recursively stores an literal itself: bottom:"bottomLayer". The third member is referenced as numbers which holds an array with 5 values. The last member is referenced as start and its respective value is an anomyous function.

1
  • Is this a real question, or homework?? Commented Oct 17, 2011 at 20:19

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.