array
Array.prototype.clone=function(){ return this.slice(0); }

对象

var o = {a: [1]};

//浅拷贝
var o1 = $.extend({}, o);
console.log(o1.a === o.a);  // true

//深拷贝
var o2 = $.extend(true, {}, o);
console.log(o2.a === o.a);  //false




相关文章:

  • 2022-12-23
  • 2021-05-20
  • 2021-05-30
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2021-04-03
  • 2021-11-17
猜你喜欢
  • 2022-01-27
  • 2021-07-20
  • 2021-05-22
  • 2021-11-08
  • 2022-12-23
  • 2022-03-07
  • 2022-12-23
相关资源
相似解决方案