📅  最后修改于: 2022-03-11 15:04:14.211000             🧑  作者: Mango
// example of pass array by value
let arr = [ 1 , 2 , 3 ];
// new Array => constructor take args & make array using it
// ...arr => just extract all array elements in this place
let arr_copy = new Array( ...arr ); // pass by value
arr_copy[0] = 99; // proof :)
console.log( arr ); // output => [ 1 , 2 , 3 ]
console.log( arr_copy ); // output => [ 99 , 2 , 3 ]