JavaScript is an untyped language. This means that a JavaScript variable can hold a value of any data type. It does not work like C, C++, Java; datatypes like int, char are not needed here.
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. You can try to run the following code to learn how to declare a variable in JavaScript
Example
Live Demo
<html>
<body>
<script>
<!--
var age = 20;
if( age > 18 ) {
document.write("<b>Qualifies for driving</b>");
}
//-->
</script>
</body>
</html>