Mega Code Archive

 
Categories / JavaScript Tutorial / Statement
 

Use if statement to compare the numbers

< html> <head> <title>Use if statement to compare the numbers</title> <script> var temp = 0; var perfectTemp = 65; temp = Math.floor(Math.random() * 100) + 1; alert ("It's " + temp + " degrees outside. "); if (temp < perfectTemp){   alert("Low!!"); } </script> </head> <body> <h3>Hit Reload to see another temperature</h3> </body> </html>