But in Espruino, var, let and const are treated the same. Eventually this will change but right now you can assign to a const, although as @HughB says it's a good idea to use as the linter can still check it and throw up errors
Yeah I understand how they work in other Javascript environments, I was curious about espruino specifically.
As long as there aren't any disadvantages to using let and const in espruino I'll continue to use them since that is what I usually use in JavaScript these days.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It's best to look at an actual JS reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const
But in Espruino,
var
,let
andconst
are treated the same. Eventually this will change but right now you can assign to aconst
, although as @HughB says it's a good idea to use as the linter can still check it and throw up errors