【发布时间】:2013-10-08 11:31:51
【问题描述】:
首先,请看我的代码。
function test(){
this.item = 'string';
this.exec = function(){
something();
}
function something(){
console.log(this.item);
console.log('string');
}
}
我创建了类并调用了'exec function',就像这段代码
var t = new test();
t.exec();
但结果是……
undefined
string
我想从某个函数访问 test.item。
你有什么解决办法吗?
【问题讨论】:
标签: javascript html