Number - JavaScript | MDN

developer.mozilla.org

Tin mới

HTML: Markup language

See all HTML references

Date & time formats

See all HTML guides

CSS: Styling language

See all CSS references

See all CSS guides

Centering an element

JavaScript: Scripting language

Standard built-in objects

Expressions & operators

Statements & declarations

See all JavaScript references

Control flow & error handing

Loops and iteration

Working with objects

See all JavaScript guides

Web APIs: Programming interfaces

Service worker API

Using the Web animation API

Using the Fetch API

Working with the History API

Using the Web speech API

All web technology

Progressive web apps

Learn web development

Getting started modules

Structuring content with HTML module

CSS styling basics module

Dynamic scripting with JavaScript module

Border-image generator

Border-radius generator

Box-shadow generator

Color format converter

Number.MIN_SAFE_INTEGER

The JavaScript Number type is a double-precision 64-bit binary format IEEE 754 value, like double in Java or C#. This means it can represent fractional values, but there are some limits to the stored number's magnitude a

Number.MAX_SAFE_INTEGER

The JavaScript Number type is a double-precision 64-bit binary format IEEE 754 value, like double in Java or C#. This means it can represent fractional values, but there are some limits to the stored number's magnitude a

Numeric separators

converted to a primitive

[Symbol.toPrimitive]()

Number.parseFloat()

Many built-in operations that expect numbers first coerce their arguments to numbers (which is largely why Number objects behave similarly to number primitives). The operation can be summarized as follows:

Number.NEGATIVE_INFINITY

The smallest interval between two representable numbers.

Number.POSITIVE_INFINITY

The smallest interval between two representable numbers.

Number.isInteger()

Determine whether the passed value is a finite number.

Number.isSafeInteger()

Determine whether the passed value is a finite number.

Number.prototype.constructor

The constructor function that created the instance object. For Number instances, the initial value is the Number constructor.

Number.prototype.toExponential()

Returns a string representing the number in exponential notation.

Number.prototype.toFixed()

Returns a string representing the number in exponential notation.

Number.prototype.toLocaleString()

Returns a string representing the number in exponential notation.

Object.prototype.toLocaleString()

Returns a string with a language sensitive representation of this number. Overrides the Object.prototype.toLocaleString() method.

Number.prototype.toPrecision()

Returns a string representing the number in exponential notation.