私は私がそれを実行するとき、私はこのコードを持っています未定義表示されます。ただし、このキーワードでグローバルプロパティにアクセスできます。なぜ私は未定義の値を得ています
var firstName = "Peter",
lastName = "Ally";
function showFullName() {
// "this" inside this function will have the value of the window object
// because the showFullName() function is defined in the global scope, just like the firstName and lastName
alert (this.firstName + " " + this.lastName);
}
showFullName();
http://jsbin.comを生産するとのことに注意してください。/gerexi/1/edit?js、output - 私は問題を再現できません。 – Quentin
私はそれほどOKではない –
厳密なモードでは、それはちょうどエラーを投げる。これが_inside_別の関数に配置されていると、 "undefined undefined"と表示されます。 – vlaz