en.javascript.info/1-js/04-object-basics/01-object/4-const-object/solution.md
Ilya Kantor 9ad9063d00 up
2016-11-28 21:35:42 +03:00

318 B

Sure, it works, no problem.

The const only protects the variable itself from changing.

In other words, user stores a reference to the object. And it can't be changed. But the content of the object can.

const user = {
  name: "John"
};

*!*
// works
user.name = "Pete";
*/!*

// error
user = 123;