best way to clone an array in javascript code example Example: js clone array var clone = myArray.slice(0);