Closed vibl closed 5 years ago
In "Question 29. Write a function called deepClone which takes an object and creates a object copy of it.", the deepClone function should check for a null value:
null
if( typeof object[key] === 'object' && object[key] !== null )...
if( typeof object[key] === 'object' && object[key] !== null )
What's more, we usually want to also check for hasOwnProperty().
hasOwnProperty()
fixed check for null. About hasownproperty I'm not that sure...
In "Question 29. Write a function called deepClone which takes an object and creates a object copy of it.", the deepClone function should check for a
null
value:if( typeof object[key] === 'object' && object[key] !== null )
...What's more, we usually want to also check for
hasOwnProperty()
.