Creating objects in array


Hello, dear people!
In this lesson (11 Arrays and Objects) we need to put some staff to array and one of them must me object.
in the hint says made object first, then put it to array:

var myObj = new Object(); myArray [myObj];

i made like this:

var myArray = [1, true, "hey", myObj = new Object(), 22];

and system let me go. but i'm not sure if it could work in the real life. could it? is it good to do like this?
thank you :smile:


No, this is not good. Never embed the declaration like that.


thank you! i was thinking so, thats why had a look to hint. but want to be sure.