DEV Community

loading...

Discussion on: Demystifying "const" variables in JavaScript

Collapse
jckuhl profile image
Jonathan Kuhl

It's always been my rule of thumb.

Use const. If you need to reassign it, change the variable to let. No reason to use var anymore.

Collapse
adam_cyclones profile image
Adam Crockett

One reason to use var: prototype something in the browser console and get something wrong, for that session your const won't be changeable, so use var for fast prototyping