3 ms·
The value `null` and the value `"null"` are not the same thing in Javascript, and `null == 'null'` is `false`.
by crooked-v 8y ago
The value `null` and the value `"null"` are not the same thing in Javascript, and `null == 'null'` is `false`.
- cheeze 8y agoAnd if we set x=[0], then x==x is true and x!=x is also true... And []+[] = "" And []+{} = [object Object] And {}+[] = 0 And {}+{} = NaN
- gmiller123456 8y agoIf you have already coerced the variable to be a string, then you can end up with with a null value becoming the string "null". E.g. the below statement evaluates to true: new String(null)=="null" And it used to be a lot easier to make that mistake like something with: ""+a Which different browsers handled differently.