-
Notifications
You must be signed in to change notification settings - Fork 1
ToRadix
ricardoboss edited this page Sep 13, 2023
·
1 revision
toRadix
converts a number to a string representing the number in the specified radix (base).
toRadix(number value, number radix)
-
value
is the number to convert. -
radix
is the radix (base) to use for the conversion. Must be an integer (supported:2
,8
,10
,16
).
- Returns
null
for an invalid/unsupported radix.
toRadix(255, 16) // "FF"
toRadix(255, 10) // "255"
toRadix(255, 8) // "377"
toRadix(255, 2) // "11111111"
toRadix(255, 1) // null
© 2023 Ricardo Boss • Licensed under MIT • Want to update this page? Edit it on GitHub and submit a pull request!