Lesson 14 Decisions, Decisions, not taking my comparison


Could anyone please tell me what's wrong with my code. I copied exactly like the example but it's still not running.

thanx in advance!

if ("myname".length >= 7 ) {
console.log("You have a long name" );


Hi @garf1eld

You will probably want to drop the double quotes from around "myname" in order to progress. If this fails please post what error you are receiving and your entire code, it looks like you are at least missing the declaration for the variable myname, and someone will help you as soon as they can.

if (myname.length >= 7 ) { //remove quotes
    console.log("You have a long name" );


Hi Mike, thanks for replying!! I removed the quotes and received the message below.
Thank you,

Oops, try again.
It looks like 'Ingrid' on line 1 was not defined before it was used.
This means either you need to define it, 'Ingrid' is spelled
incorrectly or you need quotes around 'Ingrid'.


@garf1eld, I just looked up that lesson. In short you can restore your quotes around you check, in the if condition, my apologies I thought there was more code and you were using myname as a variable.
Simply put the reason you are having errors is you are not meeting the lesson requirement. The lesson wants you to make an if statement that is true so that the code inside the if statement is executed.

The easiest way with your original example is to simply change your greater than or equals to, to a less than or equals to. The reason being right now you are comparing if the length of myname >= 7, which it is not, it is only 6 characters long......

if ("myname".length <= 7 ) { //make this a <= or add another letter to myname so it is equal to at least 7
    console.log("You have a long name" );


Thanks Mike it worked!!!!
ok,now i understand why it didn't work.
Thanx again,