What is difference between deep and shallow object coping in JavaScript?

devquora
devquora

Posted On: Feb 22, 2018

 

Some differences are:

  • Deep copy means copies all values or properties recursively in the new object whereas shallow copy copies only the reference.
  • In a deep copy, changes in the new object don't show in original object whereas, in shallow copy, changes in new objects will reflect in the original object.
  • In a deep copy, original objects do not share the same properties with new object whereas, in shallow copy, they do.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    JavaScript Interview Questions

    Explain what is Javascript?

    Javascript Javascript is an object-oriented computer programming language commonly used to create interactive effects wi..