ES6 Handbook
var to const/let
In ES5, you declare variables via var. Such variables are function-scoped, their scopes are the innermost enclosing functions. The behaviour of varis occasionally confusing. This is an example:
var x = 3;
function func(randomize) {
...
vedb.hashnode.dev12 min read