Last active
November 19, 2021 16:34
-
-
Save SergioJuniorCE/ac31a405c1c9db5ba9de1be73d77f1a5 to your computer and use it in GitHub Desktop.
How to remove an specific item from arrat
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
let array = [0, 1, 3, 4, 5]; | |
let item = 3; | |
console.log(array); | |
const index = array.indexOf(item); | |
if (index > -1) { | |
array.splice(index, 1); | |
} | |
console.log(array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment