63. create `_.cloneDeep()`

JavaScriptAlgorithmLodash
Is this helpful ?

from all members: - accepted / - tried

Object.assign() could be used to do shallow copy, while for recursive deep copy, _.cloneDeep could be very useful.

Can you create your own _.cloneDeep()?

The lodash implementation actually covers a lot of data types, for simplicity, your code just need to cover

  1. primitive types and their wrapper Object
  2. Plain Objects (Object literal) with all enumerable properties
  3. Array

Let's try to solve this problem within 15 mintues.

Discuss(10)