Loading, please wait...

Numbers

JavaScript Numbers

In JavaScript, number type represents numeric values which may be float, decimal, long, hexadecimal or integer.

In number type, the integer values must not be enclosed within quotes and it also contains the decimal values.

 

Code:

<html> 
<head> 
</head> 
<body> 
<script>
var x = 12;
var y = 12.34;
document.write(x,"<br>",y);
</script>
</body> 
</html> 

Here, the two variables are x and y assigns a value of 12 and 12.34, as we know number can contain values in decimal form as well.

 

Output: