Javascript - Question 27 help?


Saying -Oops try again. It looks like it didn't print to console... but it did so I'm confused what I've done wrong.

var myColor="Purple";
console.log= myColor;


To print to the console use:



Ive tried that as well :confused:

with and without a semi-colon at the end..


console.log() is a function call, not a variable assignment. Leave out the equal sign


First of all, I forgot to put a semicolon in my answer, it is necessary! Second, they are actually asking for you to print the length:



D'oh. That was it, didn't even see the length. Thanks


Okay, I'm going crazy now


Any idea what's happening here?


Yes. By using console.log = myColor you have overriden console.log function by assigning myColor variable to it. Either try to click that Reset Code button on the bottom of the page or have someone restart the exercise for you or use brute force approach:

    console.log = function(text){
        return text;

Then use console.log as usual.


Pressed f5 seemed to work! Thanks.