如何读取到"t1"中的值(i am a tester)
function Test() {
this.defaults = {
"t1": "i am a tester"
"t2": 这里如何读取到 "t1"中的值(i am a tester)
};
}
var test = new Test();
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
构造函数中的
this指的是实例,也就是test。如果你要在
copyT1中获取t1,使用this.defaults.t1。如果你要获取特定实例(
test)的t1,使用test.defaults.t1。// or
1.
2.
直接写就可以吧。