Skip to content

Instantly share code, notes, and snippets.

@SergioJuniorCE
Last active November 19, 2021 16:34
Show Gist options
  • Save SergioJuniorCE/ac31a405c1c9db5ba9de1be73d77f1a5 to your computer and use it in GitHub Desktop.
Save SergioJuniorCE/ac31a405c1c9db5ba9de1be73d77f1a5 to your computer and use it in GitHub Desktop.
How to remove an specific item from arrat
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