What's wrong with my Comparison code?


Please check my code at ,

and let me know what mistake I've made.


Error Message

Oops, try again. Make sure you typed in the string exactly, used .length, and used the right comparator.

My code,
var len = "I'm coding like a champ ".length;
console.log('Sentence Length is = ' + len);
if(len > 10){
    console.log('String Length Greater than 10');



Hey @rcrteam :slight_smile:
Your source code is definitely correct, I suggest you try running that JavaScript file on a website with a built-in compiler called Programmr to test that it's not just the website.
But it's not working simply because you used variables and conditions and those haven't been introduced to you yet.
To fix this error, just remove the variable and have that string with the function .length > 10

Hope this helps!!!


It is a bit confusing....
but the only thing you should be using....
"I am coding as a champ".length > 10
throw out all the other code.....


Thanks a lot for the explanation. It really Helped.


Thanks for the help. I guess, I've used codes that was not expected to be used at the beginning level . I'll correct it, thanks.


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