javascript delete user input value in array

Solutions on MaxInterview for javascript delete user input value in array by the best coders in the world

showing results for - "javascript delete user input value in array"
Allison
29 Nov 2019
1var array = ['one','two','three',4,5,6,7,8,9,10];
2var remove = function(removeID){
3    var index = array.indexOf(removeID);
4    if (index>-1) {
5        array.splice(index, 1);
6    }
7}
8remove(prompt("Enter ID of the worker you wish to remove: "));
9console.log(array);