JavaScript has only one type of number.
Numbers can be written with, or without decimals.
JavaScript numbers can be written with, or without decimals:
Extra large or extra small numbers can be written with scientific (exponent) notation:
JavaScript is not a typed language. Unlike many other programming languages, it does not define different types of numbers, like integers, short, long, floating-point etc.
All numbers in JavaScript are stored as 64-bit (8-bytes) base 10, floating point numbers.
Integers (numbers without a period or exponent notation) are considered accurate up to 15 digits.
The maximum number of decimals is 17, but floating point arithmetic is not always 100% accurate:
JavaScript interprets numeric constants as octal if they are preceded by a
zero, and as hexadecimal if they are preceded by a zero and x.
| Never write a number with a leading zero, unless you want an octal conversion. |
Properties:
Methods:
For a complete reference of all the properties and methods that can be used with the Number object, go to our Complete Number Object Reference.
The reference contains both descriptions and examples, for each property and method.
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.