Skip to content

Instantly share code, notes, and snippets.

@qetr1ck-op
Created December 30, 2015 13:08
Show Gist options
  • Save qetr1ck-op/bf8b0d0ffe7afcf1988a to your computer and use it in GitHub Desktop.
Save qetr1ck-op/bf8b0d0ffe7afcf1988a to your computer and use it in GitHub Desktop.
const incrementCounter = (list, i) => {
/*return list.slice(0, i)
.concat(list[i] + 1)
.concat(list.slice(i + 1));*/
return [
...list.slice(0, i),
list[i] + 1,
...list.slice(i + 1)
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment