如何查看正在访问的对象,有效创建动态setter?
我想做这样的事情:
var People = {};
// ...some code to change accessor on People...
var greeting = People.StevenSpielberg;
alert(greeting); // "Hi StevenSpielberg!"
我写的伪代码将是:
People[name] = function(name) { return "Hi " + name; }
有什么想法吗?