10. Array positions - bug in code?


#1

Asks me to print out 4th element in array - this is my code:

var junkData = ["Eddie Murphy", 49, "peanuts", 31];
console.log = junkData[3];

Still says "Oops, try again. Alas, you should have printed 31, as that is the 4th element!"

Am I doing something wrong, and if it's a bug how on earth do I move forward?!

Thanks!!


#2

The above line has overwritten JavaScript's console.log() method so logging is not possible, now. log() is a function (method, actually), not a variable.

Refresh your page to restore the native JS function, and change that line to,

    console.log(junkData[3]);