JavaScript判断对象有没有定义

if ( typeof(callbackfun) != "undefined" ) {
callbackfun();
}

原文地址:https://www.cnblogs.com/mrnx2004/p/10579574.html