Copy:Clone A JavaScript Array

January - 2022

Shallow copy a one dimensional array with the spread operator

const originalArray = ['a', 'b', 'c', 'd']
const newArray = [...originalArray]

You can now change originalArray without changing newArray