Error Message on JavaScript Lesson 1 Exercise 6. Editor and Comments


6. Editor and Comments

I have followed the instructions and have gotten the correct answer (4) but I get the following error message.

"Oops, try again. Did you find the length of "cake"?. Click "Stuck? Get a hint!" for an example."

// This is a comment that the computer will ignore. 
// It is for your eyes only!
"cake" .length;

Thank you for your help!


since javascript is not a space-sensitive language, I guess the reason the error message pops up might have something to do with how Codecademy tests the precision of users' answers. For example, it may test the answer by counting the length of the whole input " 'cake'.length " and the extra space you put in increases the length of the input so the error message pops up even though you have got the right answer. But I'm just guessing, please correct me if I'm wrong:)


Javascript is whitespace sensitive meaning they should be no unnecessary space between characters,

should be,



Coding in general is very strict about the little details: indentations, missing brackets, dots, commas, spaces, the list goes on and on. Of course it changes in every language but a nice practice could be trying to be aware of this and being a little more careful.
Maybe the space just slipped! It's cool of course. That's why we're here, those who know everything don't really learn much huh? :wink:


Thank you for the quick response!


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