Created
May 16, 2018 16:44
-
-
Save calevano/12d34c4a7f9498471d4aae3d7a640df1 to your computer and use it in GitHub Desktop.
function to remove index in array
This file contains hidden or 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 remove(array, element) { | |
const index = array.indexOf(element); | |
if (index !== -1) { | |
array.splice(index, 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment