Perhaps a somewhat theoretical question, but to check if a variable exists or not, this is most commonly advised:
typeof(var)==='undefined'
or typeof(var)!=='undefined'
How does this differ from typeof(var)=='undefined'
(or typeof(var)!='undefined'
) ?
I mean ===
vs ==
. Or !==
vs !=
. I know this normally means comparison of type as well as value, but in this case, typeof(something)
always evaluates to a string, right?
Is there any scenario possible where typeof(var)==='undefined'
and typeof(var)=='undefined'
are not the same?