JavaScript is untyped language. This means that a JavaScript variable can hold a value of any data type. To declare variables in JavaScript, you need to use the var keyword. Whether it is a number or string, use the var keyword for declaration.
Here’s how you can declare numbers in JavaScript −
var points = 100; var rank = 5;
Example
You can try to run the following code to learn how to declare number in JavaScript −
<html> <body> <script> <!-- var age = 20; if( age > 18 ){ document.write("<b>Qualifies for driving</b>"); } //--> </script> </body> </html>