Skip to content

Instantly share code, notes, and snippets.

@kylefdoherty
Created February 13, 2018 16:02
Show Gist options
  • Save kylefdoherty/2bd2190a324e2eac3433c33f5fe3b1d1 to your computer and use it in GitHub Desktop.
Save kylefdoherty/2bd2190a324e2eac3433c33f5fe3b1d1 to your computer and use it in GitHub Desktop.
const immutableArray = [1, 2, 3, 4]
const index = 2
const newArrayLess3 = [
...immutableArray.slice(0, index),
...immytableArray.slice(index + 1),
]
# => newArrayLess3 = [1, 2, 4]
# => immutableArray = [1, 2, 3, 4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment