To check 'undefined' in JavaScript,
you can do the following:
console.log(typeof a === "undefined")
true
You can print the type of an 'undefined' variable as follows:
console.log(typeof a);
undefined
and you can print the type of the 'undefined' itself as follows:
console.log(typeof (typeof a));
string
Reference:
http://stackoverflow.com/questions/3390396/how-to-check-for-undefined-in-javascript
No comments:
Post a Comment