📜  js let vs var 性能 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:18.538000             🧑  作者: Mango

代码示例1
let;  // Local scope only. Only visible in the scope it is declared in.
var;  // Function scope.
      // Visible in the entire function, even if declared in a for loop.

/*
"After testing this in Chrome and Firefox, this shows that let is faster 
than var, but only when inside a different scope than the main scope of a 
function. In the main scope, var and let are roughly identical in 
performance. In IE11 and MS Edge, let and var are roughly equal in performance 
in both cases."
*/