JavaScriptでのオブジェクト指向プログラミングに関する本を読んでいて、奇妙な振る舞いをしています。
function f1() {
var a = 1;
console.log('a in f1 function ', a);
console.log('f2() called ', f2());
return 'f1 return value';
}
function f2() {
console.log('a value in f2() ', a);
return a;
}
var a = 5;
a = 55;
var foo = 'bar';
console.log('delete a: ', delete a);
console.log(a);
console.log(f1());
console.log('delete window.f2: ', delete window.f2);
console.log(f1());
console.log('delete foo: ', delete foo);
私のdeleteVARIABLEが(Firefoxで)falseを返し、厳密モードで次のような警告が表示される理由を誰かが理解できますか?
SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
console.log('delete foo: ', delete foo);