deepFreeze
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, applyingdeepFreeze()as necessary. - Finally, use
Object.freeze()to freeze the given object.