Just out of interest, has anyone had this kind of thing affect them in any actual work? It seems to come up in interview questions etc. but I've never had it cause any kind of problem.
One way I think I have faced it..
Whenever I have written something like,
if (!age) { }
I was sure, it ruled out undefined and null too. Knowing it gives additional confidence, :)!
undefined
null
To be exact, it will also rule out NaN, "", '', and -- very error prone -- 0.
NaN
""
''
0
Yeah true.. all those unwanted things! :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Just out of interest, has anyone had this kind of thing affect them in any actual work? It seems to come up in interview questions etc. but I've never had it cause any kind of problem.
One way I think I have faced it..
Whenever I have written something like,
I was sure, it ruled out
undefined
andnull
too. Knowing it gives additional confidence, :)!To be exact, it will also rule out
NaN
,""
,''
, and -- very error prone --0
.Yeah true.. all those unwanted things! :)