var tmp = new Date();function f() { console.log(tmp); if (false) { var tmp = 'hello world';
}
}
f(); // undefinedvar tmp = new Date();function f() { console.log(tmp);
}
f(); // Tue Feb 26 2019 17:41:29 GMT+0800 (中國標準時間)這個明明if不會執(zhí)行 相當于沒有 為什么寫不寫 輸出就不一樣呢
var 提升 問題
BIG陽
2019-03-10 14:31:15