I'm having problems with splice in my code, I don't know why is not working, I need to remove the minimum integer from the array.
Here's my code:
var players = [
"Jug 1",
"Jug 2",
"Jug 3",
"Jug 4"
];
var arrTotal = [72, 71, 70, 75];
function winners(arr) {
var fstPlace = [], sndPlace= [];
var min = Math.min.apply(null, arr);
console.log(min);
for (var i = 0; i < arr.length; i++) {
if (arr[i] == min) {
fstPlace.push(arr.indexOf(min, i));
}
}
if (fstPlace.length == 1) {
console.log("1st: " + fstPlace);
arr.splice(min, 1);
console.log(arr);
}
else {
console.log("Tie: " + fstPlace);
}
}
winners(arrTotal);