27 i did it but it says I didn't


#1

Oops, try again. It looks like you didn't print the length myColor to the console!
Here is my code:
var myColor="blue";
"blue".length;
console.log=(myColor.length)


#2

That is your problem line of code.

"... print the length of myColor ..."


#3

Doing that isn't great either. You have just replaced all of the built in code in the log method of your console object with 4. Not exactly what you had in mind - no?

Do you see the problem?


#4

I tried it didn't work any other ideas


#5

Tried what exactly? If you post your updated code then I can see what you've done.


#6

var myColor="blue"
console.log=(myColor.length)


#7

Thanks! I've just gone to have a look at what the lesson is really asking for -- I should have done that first and saved us a few minutes.

You still have the problem there where you are wiping out all the built-in code for the console's log method and replacing it with 4.

You never want to make console.log equal to anything. What you do want to do is send the data that you want printed to it, and you do that like this:

console.log(myColor.length);

See the difference?

When you first try it to submit it you will likely get an error -- that's because you overwrote/replaced the log's built-in code with 4.

Fortunately, it is usually easy to restore that code. You will just need to refresh/reload your web page.