a number is a double is a float

February 03, 2014

JavaScript has a single number type — a 64-bit floating point number. Since there is no separate integer type, 1 and 1.0 are the same value.

One of the consequences is that the / operator may return a floating point number even if both operands are integers. Goodbye casting!

JavaScript: The Good Parts

Awesome.


Katie Leonard

Mostly Katie explaining things to herself.

© 2025