Last active
January 5, 2021 16:53
-
-
Save Jagathishrex/3019e35693afd01417b14dd741645699 to your computer and use it in GitHub Desktop.
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 removeElement(arr, ele){ | |
const index = arr.indexOf(2); | |
if (index > -1) { | |
arr.splice(index, 1); | |
} | |
} | |
const numbers = [1, 2, 3, 4]; | |
removeElement(numbers, 2); | |
console.log(numbers);// [1, 3, 4]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment