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

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

代码示例5
// 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));