javascript - I want to replace all values with another array values , both arrays are in same size -
eg:
var array1=array(1,2,3,4,5,6);
var array2=array(7,8,9,10,11,12);
after replacing array2 array1 values resulting array should be
var array1=array(7,8,9,10,11,12);
use slice
:
array1 = array2.slice(0);
this take copy of array2
, not make reference it, if make changes array2
won't reflected in array1
.
Comments
Post a Comment