X_VALUE) . Values
higher than that are replaced with the special number constant [ ` Infinity `
](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity) .

Integers can only be represented without loss of precision in the range -2  53
\+ 1 to 2  53  \- 1, inclusive (obtainable via [ ` Number.MIN_SAFE_INTEGER `
](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER)
and [ ` Number.MAX_SAFE_INTEGER ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER) ),
because the mantissa can only hold 53 bits (including the leading 1).

More details on this are described in the [ ECMAScript standard
](https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-
ecmascript-language-types-number-type) .

###  Number coercion

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 ](https://tc39.es/ecma262/multipage/abstract-
operations.html#sec-tonumber) can be summarized as follows:

  * Numbers are returned as-is. 
  * [ ` undefined ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined) turns into [ ` NaN ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN) . 
  * [ ` null ` ](/en-US/docs/Web/JavaScript/Reference/Operators/null) turns into ` 0 ` . 
  * ` true ` turns into ` 1 ` ; ` false ` turns into ` 0 ` . 
  * Strings are converted by parsing them as if they contain a [ number literal ](/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#numeric_literals) . Parsing failure results in ` NaN ` . There are some minor differences compared to an actual number literal: 
    * Leading and trailing whitespace/line terminators are ignored. 
    * A leading ` 0 ` digit does not cause the number to become an octal literal (or get rejected in strict mode). 
    * ` + ` and ` - ` are allowed at the start of the string to indicate its sign. (In actual code, they "look like" part of the literal, but are actually separate unary operators.) However, the sign can only appear once, and must not be followed by whitespace. 
    * ` Infinity ` and ` -Infinity ` are recognized as literals. In actual code, they are global variables. 
    * Empty or whitespace-only strings are converted to ` 0 ` . 
    * [ Numeric separators ](/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#numeric_separators) are not allowed. 
  * [ BigInts ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) throw a [ ` TypeError ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) to prevent unintended implicit coercion causing loss of precision. 
  * [ Symbols ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) throw a [ ` TypeError ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) . 
  * Objects are first [ converted to a primitive ](/en-US/docs/Web/JavaScript/Data_structures#primitive_coercion) by calling their [ ` [@@toPrimitive]() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive) (with ` "number" ` as hint), ` valueOf() ` , and ` toString() ` methods, in that order. The resulting primitive is then converted to a number. 

There are two ways to achieve nearly the same effect in JavaScript.

  * [ Unary plus ](/en-US/docs/Web/JavaScript/Reference/Operators/Unary_plus) : ` +x ` does exactly the number coercion steps explained above to convert ` x ` . 
  * The [ ` Number() ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/Number) function: ` Number(x) ` uses the same algorithm to convert ` x ` , except that [ BigInts ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) don't throw a [ ` TypeError ` ](/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError) , but return their number value, with possible loss of precision. 

[ ` Number.parseFloat() ` ](/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Number/parseFloat) and [ `
Number.parseInt() ` ](/en-
US/docs/Web/