In javascript numbers can be written with or without decimals.

The following code declares a number with decimals and without decimals.
var v1=100;//number without decimals.
var pi=3.174;//number with decimals.


NaN also known as not a number is a reserved word in Javascript which is used for indicating a value is not a number.


In Javascript Infinity is returned as a value when you divide any number with zero or an expression value is greater than range of number data type. In Javascript Infinity range is from -Infinity to +Infinity. Hence the following code displays Infinity and -Infinty respectively.
var x=5/0;
alert(x);//displays Infinity.
var v=-10/0;
alert(v);//displays -Infinity.
Note: You can create a number in javascript as an object as well.


var age=new Number(45); Creating a number as an object is not recommended since object is slow.