Skip to content

Instantly share code, notes, and snippets.

@danomanion
Created December 22, 2019 14:40
Show Gist options
  • Save danomanion/2dc82c74329e7341967b257ed4d6e27b to your computer and use it in GitHub Desktop.
Save danomanion/2dc82c74329e7341967b257ed4d6e27b to your computer and use it in GitHub Desktop.
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