Here are some options I came up with (with the help of Twitter). They are shown in order of performance.
const names = [ 'Jon', 'Jacob', 'Jeff' ] const copy1 = names.slice() const copy2 = .concat(names) const copy3 = Object.values(names) const copy4 = [...names] const copy5 = Array.of(...names) const copy6 = JSON.parse(JSON.stringify(names)) const copy7 = names.map(i => i) const copy8 = Object.assign(, names)
Performance results can be found on jsperf.
Can you think of any others?