JavaScript Practice Object Basics in JavaScript Practicing Object Basics Calling a Method Solution

William Mead
William Mead
1,714 Points

Const vs Let

Here you are defining your variable with the keyword const. If the object were updated with a new value for string, would this be a problem? Should the variable be defined with the keyword let instead?

1 Answer

Steven Parker
Steven Parker
168,137 Points

Defining an object with "const" only prevents the variable referencing that object from being changed. Any properties inside the object can still be changed.

When the properties cannot be changed, the object is said to be "frozen". That's not related to the object being "const".