DEV Community

Discussion on: Modern JavaScript: ES6 and Beyond

Collapse
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' };
simpson.name = 'Bart'; // { name: 'Bart' }
simpson = { name: 'Bart' };  // TypeError: Assignment to constant variable
Collapse
sophia_wyl profile image
Sophia Li Author

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