Number.prototype.toString() | Number to string
TheNumber[1]objectoverridesthetoStringmethodofObject[2];itdoesnotinheritObject.prototype.toString()[3].ForNumbervalues,thetoStringmethodreturnsastringrepresentationofthevalueinthespecifiedradix.Forradixesabove10,thelettersofthealphabetindicatedigitsgreaterthan9.Forexample,forhexadecimalnumbers(base16)athroughfareused.Ifthespecifiednumbervalueisnegative,thesignispreserved.Thisisthecaseeveniftheradixis2;thestringreturnedisthepositivebinaryrepresentationofthenumbervalueprecededbya-sign,notthetw...
The Number[1] object overrides the toString method of Object[2]; it does not inherit Object.prototype.toString()[3]. For Number values, the toString method returns a string representation of the value in the specified radix.
For radixes above 10, the letters of the alphabet indicate digits greater than 9. For example, for hexadecimal numbers (base 16) a through f are used.
If the specified number value is negative, the sign is preserved. This is the case even if the radix is 2; the string returned is the positive binary representation of the number value preceded by a - sign, not the twos complement of the number value.
Both 0 and -0 have "0" as their string representation. Infinity[4] returns "Infinity" and NaN[5] returns "NaN".
If the number is not a whole number, the decimal point . is used to separate the decimal places. Scientific notation[6] is used if the radix is 10 and the numbers magnitude (ignoring sign) is greater than or equal to 1021 o...