What is the most efficient way to deep clone an object in JavaScript?

What is the most efficient way to deep clone an object in JavaScript?

Reliable cloning using a library

Since cloning objects is not trivial (complex types, circular references, function etc.), most major libraries provide function to clone objects. Don't reinvent the wheel - if you're already using a library, check if it has an object cloning function. For example,

 

posted @ 2019-07-10 10:51  ChuckLu  阅读(268)  评论(0编辑  收藏  举报