From 4bcf39d586cdbd2523fb2bd70e659436ba61f1a9 Mon Sep 17 00:00:00 2001 From: Artem Riasnianskyi Date: Thu, 22 Dec 2016 09:58:06 +0100 Subject: [PATCH] const is not constant fix add `Object.freeze()` to object defenition in Constant section --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index a56ec49..7b8b386 100644 --- a/readme.md +++ b/readme.md @@ -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.