I have tried everything I know but I can't seem to get my Math.min to return anything but NaN, yes I know returning NaN is because a value can't be converted to a number. My next question would be isn't the cleanArray output array numbers?
$('#fiveNumButton').click(function () {
let stringArray = $('#fiveInput').val().split(' ');
let numArray = stringArray.map(function(x) {
return parseInt(x, 10);
});
let cleanArray = numArray.filter(function (val) {
return val;
});
if ($("#fiveInput").val().match(/^[0-9 ]+$/) && cleanArray.length >= 5) {
$('#pickFiveResults').html("Smallest Number : " + Math.min(cleanArray));
console.log(cleanArray);
} else {
console.log("wrong");
}
});