var array = ['one','two','three',4,5,6,7,8,9,10]; var remove = function(removeID){ var index = array.indexOf(removeID); if (index>-1) { array.splice(index, 1); } } remove(prompt("Enter ID of the worker you wish to remove: ")); console.log(array);