Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JavaScript: Map() copy Array.
myArray = ["hello","Jim",22]
myArrayCopy = [...myArray]
// console.log(myArrayCopy)
// ||
myArrayCopyTwo = myArray.map((x) => x)
console.log(myArrayCopyTwo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment