I have been trying every single thing I could think of but no matter what I get stuck in an infinite loop. I want the last variable of userInput to either take the string of 'yes' so it will repeat the function or take the string of 'no' to stop the program from running. This is as close as I can get to the finished product. I need the box asking yes or no to pop up every time after the function runs once. Attached is an image of my code.

It might be because you are using the single equal sign = rather than double equal sign == for testing the stop condition.
var userInput = false;
function promptUser(){
return prompt("Enter Value");
}
while(!userInput){
var value = promptUser().toLowerCase();
if(value.indexOf("yes") != -1){
userInput = true;
console.log("Yes ! Call funtion to proceed furthur.");
}else if(value.indexOf("no") != -1){
userInput = true;
console.log("No ! Exiting program.");
}
}
It will keep on asking for values until either a Yes or No is provided as input anywhere in the string.
Problem is that, prompt has to be a part of while. The while is operating on the first userInput only and you are not updating it. This seems to work:
<!DOCTYPE html> <meta charset="utf-8"> <style> </style> <body> <script id="mainScript" type="text/javascript"> !function(){ var loopTerminate = false, res = undefined, oddEven = undefined, count = 0, rgxAnswer = /^yes$/i, rgxIsNumber = /^(?:[1-9][0-9]+)$|^[0-9]$/; function loop(){ res = prompt("Wanna test "+(!count ? "a" : "another")+" number?"); count++; if(rgxAnswer.test(res)){ testNumber(); } else { loopTerminate = true; } }; function testNumber(){ res = prompt("Enter a number"); if(!rgxIsNumber.test(res)){ alert("Not a number!"); } else { oddEven = +res % 2 === 0; alert("Number is "+ (oddEven ? "even" : "odd")); } }; while(!loopTerminate){loop()}; }(); </script> </body> </html>Save it as html and open it.