js判断某个js函数、变量是否存在
- A
//是否存在指定函数 function isExitsFunction(funcName) { try { if (typeof(eval(funcName)) == "function") { return true; } } catch(e) {} return false; } //是否存在指定变量 function isExitsVariable(variableName) { try { if (typeof(variableName) == "undefined") { //alert("value is undefined"); return false; } else { //alert("value is true"); return true; } } catch(e) {} return false; }
傲世》原创,转载请保留文章出处。
本文链接:https://www.recho.cn/25.html
版权声明:若无特殊注明,本文为《正文到此结束
发表吐槽
你肿么看?
竟然没有人吐槽,快赶紧抢沙发吧!