Update deepFreeze.md

This commit is contained in:
Angelos Chalaris
2020-07-23 09:00:21 +03:00
committed by GitHub
parent 77e605b044
commit d2e621754e

View File

@ -6,7 +6,7 @@ tags: object,recursion,intermediate
Deep freezes an object.
Use `Object.keys()` to get all the properties of the passed object, `Array.prototype.forEach()` to iterate over them.
Call `Object.freeze(obj)` recursively on all properties, checking if each object is frozen using `Object.isFrozen()` and applying `deepFreeze()` as necessary.
Call `Object.freeze(obj)` recursively on all properties, checking if each one is frozen using `Object.isFrozen()` and applying `deepFreeze()` as necessary.
Finally, use `Object.freeze()` to freeze the given object.
```js