function test(){ alert("test"); } if(typeof test!=‘undefined‘) {alert(1) test(); } else {alert(2)} if(typeof testStart!=‘undefined‘){ alert(3) } else{ alert(4) testStart(); }
JS中方法判断存在
原文:http://www.cnblogs.com/danlis/p/6015074.html