0

0 == ''

Its true or false?????

17th Sep 2020, 7:01 AM
Mohammad Hosein Jafari
Mohammad Hosein Jafari - avatar
3 Answers
+ 2
In JavaScript 0 == "" returns true 0 === "" returns false
17th Sep 2020, 7:14 AM
CHMD
CHMD - avatar
+ 1
== , loose equality operator will perform type conversion when comparing it's operands. in given example 0=='' The String '' is type casted to Number type. When an empty string is casted to Number it becomes 0. You can verify: console.log(Number('')) Also as pointed out by KINGDX === which is strict equality operator will return false if both operands are of different types. There will be no type conversion for comparison.
17th Sep 2020, 7:28 AM
šŸ‡®šŸ‡³OmkaršŸ•‰
šŸ‡®šŸ‡³OmkaršŸ•‰ - avatar
0
ConsoleLog that to find out. šŸ˜ƒ
17th Sep 2020, 7:14 AM
arturop200
arturop200 - avatar