Javascript examples for Data Type:Number
Random number between negative and positive value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/* w w w . j av a 2s.c om*/ function getNonZeroRandomNumber(){ var random = Math.floor(Math.random()*199) - 99; if(random==0) return getNonZeroRandomNumber(); return random; } for(i=0;i<100;i++) console.log(getNonZeroRandomNumber()+", "); }); </script> </head> <body> </body> </html>