Skip to content

Instantly share code, notes, and snippets.

@AlfieDarko
Created June 17, 2018 16: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 AlfieDarko/f5aa59c28a6d1be8d6795d194b7f794c to your computer and use it in GitHub Desktop.
Save AlfieDarko/f5aa59c28a6d1be8d6795d194b7f794c to your computer and use it in GitHub Desktop.
Simple array mutations
let arr = [1,2,3,4,5]
arr.push(6)
console.log(arr)
// Expected output: [1,2,3,4,5,6]
let arrClone = arr.push(7)
console.log(arrClone)
// Expected output: 7
console.log(arr)
// Expected output: [1,2,3,4,5,6,7]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment