Home / Javascript Tips Generated By ChatGPT / Copying Array with Slice in Javascript Create a shallow copy of an array. Source Code let nums = [1, 2, 3]; let copy = nums.slice(); console.log(copy); // [1, 2, 3]