Skip to content

Instantly share code, notes, and snippets.

@elliotlarson
Last active July 22, 2018 05:37
Show Gist options
  • Save elliotlarson/528d66f1f34ba0db9503b97cd8779cd6 to your computer and use it in GitHub Desktop.
Save elliotlarson/528d66f1f34ba0db9503b97cd8779cd6 to your computer and use it in GitHub Desktop.
const newCharacters = [
...characters.slice(0, index), // all the items before the update item
newName, // add the newName in place of the old name
...characters.slice(index + 1) // all the items after the update item
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment