Types of variables

suggest change

JavaScript has one Number type, an IEEE-754 double, for all of the numeric variables below. It does not have separate 32-bit integer, 64-bit integer, or 32-bit float types. Arbitrary-size integers are BigInt (12n).

var myInteger = 12;
var myLong = 9310141419482; // still a Number. Integers above 2**53 - 1 are not all exact
var myFloat = 5.5;
var myDouble = 9310141419482.22;

var myBoolean = true; // boolean
var myBoolean2 = false;

var myNotANumber = NaN;
var NaN_Example = 0/0; // NaN. 1/0 is Infinity. Division by zero does not throw

var notDefined; // undefined
// Reading an undeclared name throws ReferenceError.
// typeof aRandomVariable is "undefined" and does not throw.

var myNull = null;

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents