function enigma(inputValue) {
  var i = 0;
  while (inputValue) {
    if (++i == 5) inputValue = 0;
  }
  return i;
}
var whatAmI = enigma(5);
console.log(whatAmI);<div>Hit F12 and go to the console to view output.</div>The output I get is 5.
Why does JavaScript stop the loop if inputValue equals 0? Is this because I did not specify that as the condition in the while loop?
 
     
     
    