📜  javascript 复制数组 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:52.602000             🧑  作者: Mango

代码示例6
// this is for array with complex object
var countries = [
  {name: 'USA', population: '300M'}, 
  {name: 'China', population: '1.6B'}
];

var newCountries = JSON.parse(JSON.stringify(countries));