I don't get it!


#1

I don't get it!!!!
This is my code...

if( 100/10 "Jhon".length + 2*(2+4) == 6 )
{
console.log("Giorgia == 7");
}
else }
console.log("Love family => 11");
}

It keeps on saying that the syntax is wrong but I'm not sure why!!

Thank you


19 help
#2

Lets break this down

So

100 / 10 = 10
(jhon) 4 + 2 * 6 = 36 not 6

Yours won't work because you do 100/10 then go straight into "jhon".length so it reads it as 10 4 + and it gets confused.

Lets make this simpler. Use === to check if the value is exactly equal to the answer.

Try this

if("john".length + 2 / 3 === 2 )  {
console.log(true);
}else{
console.log(false);
}

#3

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