JS Built-ins
NumbertoStringbeginner

toString() β€” default base 10

πŸ“– Usage Example
// Convert number to string in a given base
(255).toString(16)   // β†’ 'ff'
(255).toString(2)    // β†’ '11111111'
(255).toString(10)   // β†’ '255'

Use toString() with a radix argument to convert a number to its binary, octal, hexadecimal, or other base string representation.

toString() β€” Base 10

(255).toString() (no radix) returns the decimal string '255'.

πŸ’‘ Hints (1)
  • β€’ Without a radix, `toString()` defaults to base 10.