var/let/const最佳实践讲解
var/let作用域区别:1. 全局作用域访问不同var可以被顶级window访问 <script> var a = 12; function f() {}; console.log(window.a); // 12 console.log(window.f); // f(){} </script>let/const不可被顶级window访问 <script> let a1 = 1; let b1 =