1

当创建 tempobj 的多个实例时,以下代码是否会创建函数 fun1 的多个实例?我知道为每个对象创建了单独的 fun2 实例。我需要知道 fun1 是否也会发生同样的情况。

function tempobj(){
 var fun1 = function(){ 
  //do something;
 }
 this.fun2 = function(){
  //do something;
  }
}
var obj1 = new tempobj();
var obj2 = new tempobj();
var obj3 = new tempobj();
4

1 回答 1

0

答案是肯定的,每次创建对象时都在定义 fun1。

于 2012-04-10T10:38:49.520 回答