Skip to content

Instantly share code, notes, and snippets.

@carlosvega20
Created June 20, 2016 16:28
Show Gist options
  • Save carlosvega20/e75c96acb703513115bc02add33f6448 to your computer and use it in GitHub Desktop.
Save carlosvega20/e75c96acb703513115bc02add33f6448 to your computer and use it in GitHub Desktop.
const add = (list, item) => {
return […list, item]
}
const remove = (list, index) => {
return [
…list.slice(0,index),
…list.slice(index+1)
]
}
const increment = (list, index) => {
return [
…list.slice(0,index),
list[index] + 1,
…list.slice(index+1)
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment