eg:
var Array1=array(1,2,3,4,5,6);
var Array2=array(7,8,9,10,11,12);
after replacing Array2
with Array1
values
Resulting array should be
var Array1=array(7,8,9,10,11,12);
eg:
var Array1=array(1,2,3,4,5,6);
var Array2=array(7,8,9,10,11,12);
after replacing Array2
with Array1
values
Resulting array should be
var Array1=array(7,8,9,10,11,12);
Use slice
:
Array1 = Array2.slice(0);
This will take a copy of Array2
, not make a reference to it, so if you make changes to Array2
they won't be reflected in Array1
.
in this example, it is possible to exclude the value of an array of type CONST, and the value of an array is passed to or another. I had this problem.
fields = [1,2,3,4]
var t = fields.filter(n => {
return n != 4;
});
// t => [1,2,3]
fields.splice(0, fields.length, ...t);
console.log(fields);//[1,2,3]