Logging to the console


If we want to print the third element of an array, do we need to put console.log()?

When I wrote this code the answer still printed javascript to the console.

var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];



console.log(languages[2]); is how you would print out "JavaScript" :slightly_smiling:


Oh, sorry, see your question now. Well, I am not really sure if that's correct. You say languages[2]; worked?


yes it did. Maybe it's just that the instructions said "log"?


@mccbjnn That may be so! I just tried it that way and it worked. I don't think this is proper, but it's interesting that it works.


For goodness sake. Here.

var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];
for (var i = 0; i < languages.length; i++) {


What exactly do you mean? Do you realize how inconvenient this method you are using is? It defeats the whole purpose of the for loop.



var languages = ["HTML", "CSS", "JavaScript", "Python", "Ruby"];
for(var counter = 0; counter<5;counter++)


I still passed it. And why are you scolding me for passing?


What is the need for this?

Also, I didn't "scold you for passing," so I don't know where you got that idea.