.toBase(base)
Description
toBase converts a number to a string representation in the specified base (radix). Common uses include converting to binary (base 2), octal (base 8), or hexadecimal (base 16).
Parameters
toBase needs two parameters:
current base: The base a string or number is currently in (between 2 and 36)
new base: The base to convert the number to (between 2 and 36)
Usage On Numbers
It's important to remember that the output will always be a string; if converting from an abnormal base to a decimal, that decimal must be converted into a number for use in equations.
Last updated
Was this helpful?