New mode, which abolishes "let" and "var" words

I would propose a new mode (like "use strict"). In this mode, If you type "foo = 3", and you have typed "foo" for the first time in the scope, then it would be equal to you typing "let foo = 3". If it is done inside the function, then "foo" would not be added to global scope, and would not be created.

How it would work:

Today the following code:

function foo(){
bar = 5;
let bar = 3;
console.log(bar) // 5

prints "5" in the console.

I would suggest the following:

"use new mode"
function foo(){
bar = 5; // equals "let bar = 5"
let bar = 3;
console.log(bar) // 3

Prints "3" on the console.

What this will give:

  1. Faster software development as we will not write "let" everywhere. We can abolish words "var" and "let" as such, and only leave the "const" word.
    2). This should work only in "new mode", because otherwise back compatibility would be broken.

I don't think avoiding to press 4 keys will make software development faster, especially if you factor in the slowdown that having to search for a variable declaration when reading code will cause.
Personally I already experienced this when developing Python, where scoping and variable definitions works quite similarly to what you suggest. Deeply nested scopes, as they are typical in code with many closures in JavaScript, are a mess in Python - especially if you want to assign to a higher-scope variable, you explicitly have to declare it as nonlocal to prevent it from creating a new local variable that shadows the outer one.


CoffeeScript is even worse - you don't have the escape hatch and so you get 13 billion variables in your autocomplete as you try to work around it.

But yeah, I agree, 4 extra key presses isn't going to help much. (And if you're writing on a non-Latin keyboard, it's maybe 2 extra key chords on top of that, but you already have to do that just for other basic syntax.)

I agree with the above comments, and would like to add that const (for me, anyways, and I know for a lot of other developers as well) is by far the most used compared to var and let. I rarely ever see var outside an IE11-compatible environment, and variables aren't reassigned as much as they are not. This new mode would, for the most part, not change much code-wise, but it would create confusion having to differentiate between the two modes.