I am currently working on a script that involves taking values from a prompt, converting them to integers, storing them in an array, and then finding the minimum and maximum values within that array. I am unsure whether I should convert the user input to integers or the array items themselves. Additionally, I need a method to split the array into individual elements based on the user's input size. For instance, if a user enters "1 2 10 40" into the prompt, they should receive an alert indicating the minimum value is 1, the maximum value is 40, and the array length is 4. Below is snippet of the code I am experimenting with:
var numInput = prompt("Enter a series of numbers with spaces in between each:");
var numArray = [];
numArray.push(numInput);
numInput.split(" ");
alert(Math.min(numArray));
alert(Math.max(numArray));