Google adsense

Search

Thursday, March 24, 2011

JavaScript: check for undefined or null object/variable

if(typeof(foo) !== 'undefined' && foo != null) {
//you can use foo!
}

Thanks,

InfoSource: http://snipplr.com/view/14618/javascript-check-for-undefined-or-null-objectvariable/

No comments:

Post a Comment