DEV Community

Discussion on: Constants are not really constants

 
aminnairi profile image
Amin

We could follow the path taken by Elm and their awesome error messages like:

I saw you used a constant here:

const fruits = [...];
      ^
      |
     here

It seems like you tried to update one of its member:

fruits[0] = ...
       ^
       |
      here

I think that you might wanna use Object.freeze to prevent causing side effects

const fruits = Object.freeze([...]);