0
0 == ''
Its true or false?????
3 Answers
+ 2
In JavaScript
0 == "" returns true
0 === "" returns false
+ 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.
0
ConsoleLog that to find out. š