Adding looped prompts together to get a sum - Javascript Operator

Javascript examples for Operator:Arithmetic Operator

Description

Adding looped prompts together to get a sum

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//from  w ww  . j a  v  a 2 s .  co m
var input = '3';
var min = parseInt(input);
while (input !== "0") {
    input = parseInt(input);
    if (input < min) {
        min = input;
    }
    input = '2';
}
console.log(min);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials