Why output is - true? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why output is - true?

Console.log("itchy" != "Scratchy"); Becoz both are string , it is true but becoz of != It should may return false.

20th Aug 2022, 12:46 PM
RD:programmer
RD:programmer - avatar
2 Answers
+ 4
itchy is a mouse wich is not equal to scratchy that's a cat! They are aslo totally different strings, so it will mostly be true because != means "NOT equal to"
20th Aug 2022, 12:52 PM
Slick
Slick - avatar
+ 2
undoubtedly it will print true because you have set "!=" that means "isNotEqualTo". String value isn't same so it will return true.
20th Aug 2022, 12:49 PM
Davinder Kumar
Davinder Kumar - avatar