What I want to do is to use as many immutable variables as possible, thus reducing the number of moving parts in my code. I want to use \"var\" and \"let\" only when it\'s n
First of all, there are no constants in JS (until ECMAScript 6 proposal). You will have to use var to construct something like that. If you want to have "private" areas in your JS code, you use one of the features of the language, which are scopes.
So, e.g, go like this:
var kindaConstant = function(){
var donttouchthis
... do something with it
return whateveryouvedonewithit
}
In this case donttouchthis is not that easily mutable from "outside".