Deep Clone objects the right way in JavaScript!
_.cloneDeep() or JSON.parse(JSON.string())? Neither! There’s now a native method to address this.
Published in
4 min readFeb 16, 2023
Have you ever come across a situation where you will have to deep copy an object in your code, and you had to use either JSON.parse(JSON.stringify(obj))
or Loadash’s cloneDeep()
? Both of these have their pros and cons…