Number Number operation
Number Number operation
Function
Number prototype function provides number stringization, fixed-point formatting, scientific notation and base conversion capabilities.
API List
| API | Description |
|---|---|
| Number.len | Returns the number of characters after converting the number into a string. |
| Number.to_number | Returns the numeric value of the current number itself. |
| Number.to_fixed | Format a number to the specified decimal places. |
| Number.to_string | Convert a number to a string. |
| Number.to_radix | Format the integer into a string according to the specified base. |
| Number.to_char | Generates a single-character string in Unicode code points. |
| Number.to_exponential | Format a number into a string in scientific notation. |
| Number.is_int | Determine whether the current number is an integer. |
| Number.is_float | Determine whether the current number runtime type is Float. |
| Number.is_finite | Determine whether the current number is a finite number. |
Examples
num = 255 result = num.to_radix(16) // Output: ff print result
Notes
- Number method does not modify the original number value.