4 ms·
I beg your pardon, but you do not 'need it in JS', if 'it' is referring to using === instead of == to compare strings. Here is what node.js says: > "92233
by eblume 15y ago
I beg your pardon, but you do not 'need it in JS', if 'it' is referring to using === instead of == to compare strings.
Here is what node.js says:
> "9223372036854775807" == "9223372036854775808"
false
- mikeryan 15y agoAh but more fun with Javascript >>> "9223372036854775807" == "9223372036854775808" false >>> 9223372036854775807 == "9223372036854775808" true >>> 9223372036854775807 == 9223372036854775808 true I believe the grandparent post is more referring to "general" use cases then this one. Personally I now default to strict comparison operators both in JS and PHP unless I explicitly want a loose comparison and end up missing most of these strange vagaries these days.
- tlrobinson 15y agoNot in this case, but it's commonly accepted that == is "broken" in JavaScript, and === should be the equality operator of choice most of the time. The one case where I sometimes use == is if I want to check for "null" or "undefined". Even then it scares me.