Removed unnecessary parentheses around typeof
This commit is contained in:
committed by
GitHub
parent
90b8f077fa
commit
bf87c7c8fc
@ -12,7 +12,7 @@ Finally, use `Object.freeze()` to freeze the given object.
|
|||||||
```js
|
```js
|
||||||
const deepFreeze = obj => {
|
const deepFreeze = obj => {
|
||||||
Object.keys(obj).forEach(prop => {
|
Object.keys(obj).forEach(prop => {
|
||||||
if (typeof(obj[prop]) === 'object') deepFreeze(obj[prop]);
|
if (typeof obj[prop] === 'object') deepFreeze(obj[prop]);
|
||||||
});
|
});
|
||||||
return Object.freeze(obj);
|
return Object.freeze(obj);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user