Arrays and Objects in JS


Hey! I just tried the "Arrays and Objects in JS" lesson, and I think that I got it because it printed out the correct term, "Javascript", the third term, the one that we are supposed to print out.

But, it then says that I need to

When I did print out the third term.

var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];
    console.log = languages[2];


Well do you recognize this pattern?

name = value

That means that you assign a value to a variable. So what you're doing here is replacing the console.log function with the value of "javaScript". The console has this feature that the last value used in your code is echoed, so you're able to see the correct result, but that "echo" uses a different channel than console.log would. As you can see by JavaScript being written in quotes (console.log wouldn't do this). So first of all change

console.log = languages[2];



and then before you press submit again, refresh the page to reset console.log to its functional value, otherwise you'll only get the message that console.log is not a function, as it is the value "JavaScript" instead.


Thank you so much! It worked perfectly.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.