JavaScript检测一个函数是不是new调用
JavaScript检测一个函数是否new调用
function Test(){ if(this == window || 'Test' in this){ //普通调用 }else{ //以new来实例化调用 } }