r/javascript • u/kasperpeulen • Oct 24 '16
help The only thing I hate about const ...
... is that it is 5 chars long.
For some reason, let with its 3 chars, looks more elegant.
7
Upvotes
r/javascript • u/kasperpeulen • Oct 24 '16
... is that it is 5 chars long.
For some reason, let with its 3 chars, looks more elegant.
0
u/0x13mode Oct 25 '16
const has other disadvantage, as well. You can't postpone assignment, e.g.
const a; //error!!!!! Uncaught SyntaxError: Missing initializer in const declarationif (true) {a = 1;} else {a =2}but you have to use
let. Orvar.