Skip to content

Instantly share code, notes, and snippets.

@zgulde
Last active April 12, 2017 20:11
Show Gist options
  • Select an option

  • Save zgulde/33da146b3fae4eeb78e45e5dbc15ce26 to your computer and use it in GitHub Desktop.

Select an option

Save zgulde/33da146b3fae4eeb78e45e5dbc15ce26 to your computer and use it in GitHub Desktop.
common javascript array manipulation methods

Array Methods

name modifies the original? return value description
push, unshift yes the length of the new array add element(s) to an array
pop, shift yes the element removed remove an element from the beginning or end of an array
reverse yes the new array reverses the array
sort yes the new array sort the array
splice yes an array of deleted items delete and/or add items at a specific index
indexOf, lastIndexOf no the index, or -1 if not found locate an item in an array
slice no a new array retrieve a section of an array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment