Skip to content

Instantly share code, notes, and snippets.

@masautt
Created September 6, 2019 19:18
Show Gist options
  • Save masautt/9caca1bb263eac04e77907a0c4e92a63 to your computer and use it in GitHub Desktop.
Save masautt/9caca1bb263eac04e77907a0c4e92a63 to your computer and use it in GitHub Desktop.
How to remove the first element from an array in JavaScript?
let arr = ["M", "A", "S", "A", "U", "T", "T"]
//Remove the first element
arr.shift(); // returns "M"
console.log(arr) // --> [ 'A', 'S', 'A', 'U', 'T', 'T' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment