Created
August 11, 2017 00:55
-
-
Save searleb/cd844658a1d45e81ca2746394b9a8722 to your computer and use it in GitHub Desktop.
Remove Item From Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removeItem(array, action) { | |
const actionIndex = array.indexOf(action) | |
const newArray = array.slice() | |
newArray.splice(actionIndex, 1) | |
return newArray | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment