How to freeze nested objects in javascript?
<p>I just stumbled upon Object.freeze() function. It seems to be a pretty good feature but how to make whole object (including nested objects) immutable?</p>

<p>For example I can change <code>innerProp</code> here:</p>

<pre><code>const obj = { prop: { innerProp: 1 } };
obj.prop.innerProp = 5;
console.log(obj.prop.innerProp); // 5
</code></pre>

<p>Is it possible do freeze nested objects too? (ECMAScript 5/6)</p>