为什么this
警报如undefined
下面的代码?
var testObj = {};
testObj.aMethod = function() {
this.testVar = "thing"
alert(this.anObject.dimension1);
alert(this.anObject.dimension2);
};
testObj.aMethod.prototype.anObject = {
dimension1 : this.testVar,
dimension2 : "thing2"
};
var testing = new testObj.aMethod();