let const 会发生变量提升

转发自 https://stackoverflow.com/questions/31219420/are-variables-declared-with-let-or-const-not-hoisted-in-es6

大佬问我 let const 特点   我说不会发生变量提升  被嘲笑了

按他说的    let 确实存在提升。只不过由于暂时死区的限制,你不能在 let x 之前使用 let

参考:https://www.jianshu.com/p/0f49c88cf169

猜你喜欢

转载自blog.csdn.net/weixin_42052388/article/details/81780750