JS Built-ins
NumbertoStringintermediate

toString() β€” octal with radix 8

πŸ“– 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() β€” Octal

(10).toString(8) returns the octal representation '12'.

πŸ’‘ Hints (1)
  • β€’ Octal (base 8) uses digits 0-7.