DEV Community

Discussion on: Modern JavaScript: ES6 and Beyond

gandalfarcade profile image
Chris Mumford

Really good summary. I don't know if it's worth expanding on the mutability of a const. It might not be clear to the reader based on the current example what is meant by that since it only shows reassignment is not possible. Using an object may help e.g.

const simpson = { name: 'Lisa' }; = 'Bart'; // { name: 'Bart' }
simpson = { name: 'Bart' };  // TypeError: Assignment to constant variable
sophia_wyl profile image
Sophia Li Author

Thanks, appreciate your insight! I think it's worth expanding on and added your example.