const is not constant fix

add `Object.freeze()` to object defenition in Constant section
This commit is contained in:
Artem Riasnianskyi 2016-12-22 09:58:06 +01:00 committed by GitHub
parent 02b0546772
commit 4bcf39d586

View file

@ -313,7 +313,7 @@ A variable that cannot be reassigned once defined.
```js
const five = 5
const john = {name: 'John', age: 30}
const john = Object.freeze({name: 'John', age: 30})
```
Constants are [referentially transparent](#referential-transparency). That is, they can be replaced with the values that they represent without affecting the result.