I'm trying to make a function that asks the user for a number in between whatever number is passed to the functions min and max, eg.(1,10) I can't seem to get it to work though, what am I missing/ doing wrong here?
function getProductChoice(min, max) {
do {
var productIndex = parseInt(prompt('Enter your product choice', '0'));
} while( isNaN(productIndex) || productIndex <= max || productIndex >= min);
getProductChoice(1,6);
};
whilecondition should contain "bad" outcomes. Forminandmaxit doesn't. Plus move function call outside of the function. Right now you have endless recursion.