Javascript - Question 27 help?


#1


https://www.codecademy.com/courses/getting-started-v2/4/4?curriculum_id=506324b3a7dffd00020bf661


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;


#2

To print to the console use:

console.log(myColor);

#3

Ive tried that as well :confused:

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


#4

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


#5

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:

console.log(myColor.length);

#6

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


#7

Okay, I'm going crazy now


#8

Any idea what's happening here?


#9

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.


#10

Pressed f5 seemed to work! Thanks.


#11