JavaScript === vs == for type checking -
this question has answer here:
which of following lines correct?...
if (typeof value == 'boolean') { return value; }
... or ...
if (typeof value === 'boolean') { return value; }
i thought double equal sign type of "soft compare" value
variable either string
or formal type. not so? wonder because jshint complained first version. i've changed i'm worried typeof
won't return string.
==
soft compare, typeof
returns string.
https://developer.mozilla.org/en-us/docs/web/javascript/reference/operators/typeof
Comments
Post a Comment