14. A Quick Question


exercise 14.

I just wanted to ask a question over the log that occurs after the code. Why is it that if i declare 'myArray' with var infront it logs the code as 6 (I assume from theObj.QI = 6), and when i take off the var and just call it myArray it logs the array. I'd love an explanation for this thank you.

var boo = true;

var theObj = new Object();
theObj.name = 'fancy';
theObj.QI = 6;

var myArray = [6,boo,"tom",theObj];


it is the codecademy console, as explained here by haxor. I am not sure what the roll of the var keyword is, but it isn't very important, since it just the codecademy console echoing the last thing (which can be handy, or confusing)


ahh, thank you. guess i came under the second category, but that clears it up a bit for me. Thank you