Wednesday, February 12, 2014

How to check for “undefined” in JavaScript?

This is useful thread in stackoverflow - http://stackoverflow.com/questions/3390396/how-to-check-for-undefined-in-javascript

My suggestion is:
var myVariable; // theFu has been declared, but its value is undefined
"myVariable" in window; // true
"otherVariable" in window; // false 

No comments:

Post a Comment