WHY NOT TO BAN 'VAR'? My question is not about the difference between 'var' and 'let'. All such answers are advocating the advantages of using 'let'. My question is: why not to tell frankly "do not use 'var' anymore"? Is there a reason for not being so direct?
'var' is still in use on many serious tutorial sites: Mozilla MDN, w3schools ... I am wondering if there is an hidden reason that I am missing.
There is one answer below: legacy (old browsers not supporting ES6) Is that the only reason? Any performance reason? Or some fancy use of hoisting?
[ Here was the rest of my original post...
var arr = [];    // -> const arr = [];
var obj = {};    // -> const obj = {};
var temp;        // -> let temp;
var f = function(){};    // -> const f = function(){};
Doing so, I think that the only way a variable may behave like a var variable (hoisting etc.), is an -unfortunately- undeclared variable: x = sthg; in some function (becoming: var x = sthg; at global scope).
If I missed something, it would highly help me. ]
 
    