日期:2014-05-16 浏览次数:20335 次
function classA() {
}
classA.prototype = {
constructor: function (str) {
console.log(str+'::'+static_member1);
},
static_member1: "classA"
};
alert(classA === classA.prototype.constructor);
function ClassA() {
}
ClassA.prototype = {
//constructor: ClassA, //强制将对象类型转换成ClassA,转换之后alert(cl.constructor == ClassA)为true
static_member1: "classA"
};
var cl = new ClassA();
alert(cl.constructor == Object) //true
alert(cl.constructor == ClassA) //false