how to copy an array by value in javascript code example
Example 1: js copy array into another
var destinationArray = Array.from(sourceArray);
Example 2: javascript copy array
var oldColors=["red","green","blue"];
var newColors = oldColors.slice(); //make a clone/copy of oldColors