jquery extend深度拷贝

来源:互联网 发布:爱思唯尔数据库主页 编辑:程序博客网 时间:2024/05/18 02:09
 1// 以前的 .extend()    2   jQuery.extend(    3     { name: “John”, location: { city: “Boston” } },    4     { last: “Resig”, location: { state: “MA” } }    5   );    6    // 结果:    7    // => { name: “John”, last: “Resig”, location: { state: “MA” } } 8  // 新的更深入的 .extend()    9   jQuery.extend( true,   10   { name: “John”, location: { city: “Boston” } },   11     { last: “Resig”, location: { state: “MA” } }   12  );   13  // 结果   14   // => { name: “John”, last: “Resig”,   15  //      location: { city: “Boston”, state: “MA” } }  

原创粉丝点击