If the let
keyword introduces a proper implementation of block scope, does var
any longer have a use case? I am looking at this from a software design standpoint rather than a syntactical, "well you could" standpoint.
If the let
keyword introduces a proper implementation of block scope, does var
any longer have a use case? I am looking at this from a software design standpoint rather than a syntactical, "well you could" standpoint.
If the
let
keyword introduces a proper implementation of block scope, doesvar
any longer have a use case?
There could be one use case: let
declarations in global scope don't create a property on the global object. Example:
"use strict"; // for chrome
var foo = 42;
let bar = 21;
console.log('window.foo (var)', window.foo); // 42
console.log('window.bar (let)', window.bar); // undefined