It give me correct index when i give fixed array i.e
BT_input = [11, 10, 10, 14]
But when i get array values from user this Return -1 instead of correct index ?
<html>
<body>
<script>
const BT_input = [];
var size = 3;
for(var a=0; a<=size; a++)
{
BT_input[a] = prompt('Enter Brust Time of P ' + (a));
}
function sayHello() {
var indexMenor = BT_input.indexOf(Math.min(...BT_input));
document.write(indexMenor);
}
sayHello();
</script>
</body>
</html>
you need to translate the string to number
like this