15/17 - So I don't have to define my object before putting into array?


I am concerned with exercise 15/17 - Multidimensional Arrays.
The instructions say to make a jagged array, and "The ultimate kicker? Make one of your inner arrays contain an object!" .. So I did. This is exactly what I entered:

var newArray = [[1,2],[me]]

.. I clicked submit, just to see what would happen. Sure enough, I'm prompted to start the next lesson. I entered an object into the array without defining it whatsoever. I just simply typed '[me]' and it took it. I'm concerned that there might be a flaw that codecademy should look at, because I'm certain that this array wouldn't really work without me having defined my object first.

Am I missing something?

Replace this line with your code.


"me" is not counting as an object rather you wrote a heterogeneous multidimensional(2D in this case) array.

"The ultimate kicker......" bit just to suggest you nothing mandatory. 15/17 is all about multi-dimensional array. You have wrote one. That's it!


But this;

var newArray = [[3, 4, myFoot], [true, false]];

kicks a nice: ReferenceError: myFoot is not defined.
As expected.


In case you're wondering, myBed was an class/object I defined in the previous exercise.

There's a reason why strings needs to be surrounded by quotes.
Strings need a way to differentiate themselves from identifiers, the interpreter, or compiler, will treat any non-quoted string which is not a reserved word as an identifier, and, in Javascript, in order to use such identifiers you need to declare/define them first.

My guess is that CodeAcademy's implementation of the JS interpreter carries over the elements you've created so far so you don't have define 'em again and again, saving you a lot of typing.

Well, that was my two cents.
Hope it helps, and, sorry for any bad english on this reply.


The person wrote me in two different ways .

I took it as a string and wrote "me" instead of me. I have completed all the programming language exercises as they came without being too intuitive.

If you found the differences between variable, string and object then it's good for your learning.