As you indicate, if you use a variable without specifying the type, it will be done as a global variable.
In that scenario (being the global scope) let
and var
would be more or less equivalent. It could not be defined using the reserved word const
(or let
or var
) because then the scope and scope of the variable would come into play (the block for const
and let
or the function for var
).
It is the JavaScript engine that controls this behavior and is native to the browser, so it is not something that can be redefined (as could be done with some methods rewriting the prototype).
Something you could do is, get the code from an open source browser (eg Chromium ), modify the source code of the JavaScript engine so that let
and const
work as you want and build your own version ( SO question in English on the subject ).
But as I put you in a comment, with this you would generate a browser that handles and works differently from the standard, which could lead to confusion and maintenance problems.