克隆一个 JS 对象. JavaScript

克隆一个 JS 对象. JavaScript



使用 Object.assign() 克隆对象
JavaScript example code

JavaScript

  Output result
{name: "John", age: 21}
Peter
John
使用扩展语法克隆对象
JavaScript example code

JavaScript

  Output result
{name: "John", age: 21}
Peter
John
使用 JSON.parse() 克隆对象
JavaScript example code

JavaScript

  Output result
{name: "John", age: 21}
Peter
John


.dll file is missing? Download for Windows 7, 8, 10 - Fix .dll file Missing Error on Windows | dll-box.com

BeeCoder.ORG

open source code and examples

We have been online since 2021 and 1 millions of people around the globe have visited our website since then

More visitors every month