Monday, April 29, 2013

JavaScript Null Checking, Undefined and ! Unary Operator

Google searches of "JavaScript null check" and "How to check for null in JavaScript" were returning results that left something to be desired in my opinion, so I compiled this list.

See the code live here: JsFiddle:
Code also available here:

Comparison Chart:

Hope this helps,

p.s. I used a great tool Regex Pixie by StoneFinch to generate most of the code in this example (disclaimer, I currently work for them, however I would never promote a tool I don't use myself.)
Post a Comment