Global.foo = 'this is Global';
function Foo () { }
Foo.prototype.foo = 'this is Foo';
Foo.prototype.p = function () {
// alert (nameOf (this));
alert (this.foo);
};
var a = new Foo ();
a.p (); // this is Foo
a ['p'] (); // this is Global
インスタンス.メソッド名() による呼び出しでは this がそのインスタンス自体を指しますが、インスタンス['メソッド名']() では this が Global を指してしまいます。