Help on comparisons string showing false?


i'm having trouble with question 13 Comparisons, this is my string:
The first two are showing 'true', the third is showing false & true, I don't understand why as have '==='

console.log("Xiao Hui".length < 122);
console.log("Goody Donaldson".length < 8);
console.log(8*2 === 16);

many thanks


Hey @codeplayer88578! Firstly just quickly organize your code by formatting it. You do that by selecting over your code and hitting CTRL + K. Secondly the problem is that if you want to check for equality you use 2 equal signs! Not 3. So

Your code:

Correct Code:
console.log(8*2 == 16);

Hope it helped! If it didnt please reply saying so!


This is the one that is giving your false result.


=== is a valid JavaScript comparison operator.

Unless you have a good reason to use ==, using === is safer.


Oh, Why do i always confuse Java with JavaScript :frowning:


Thank you, I've tried the 3rd question using '==' instead of '===' still seem to be getting same result true true false true. I'll have a look at this again hopefully can figure it out :smile:


I think you missed this reply:


Thank you, changed the < to a >, all 'true' now :smile: