Skip to content

Instantly share code, notes, and snippets.

@AkashRajvanshi
Created November 2, 2019 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkashRajvanshi/d80264a1ae740f5eddffa7239b2090b7 to your computer and use it in GitHub Desktop.
Save AkashRajvanshi/d80264a1ae740f5eddffa7239b2090b7 to your computer and use it in GitHub Desktop.
const numbers = [1, 2, 3] // Array
// Normal Method
const newArray = numbers.slice()
console.log(newArray) // [1, 2, 3]
// Another Method
const anotherNewArray = Array.prototype.slice.call(numbers)
console.log(anotherNewArray) // [1, 2, 3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment