parseNumber
parseNumber(num)
parseNumber(num)
Parses the input number or string and returns an object containing the float, integer, and sign components of the number. It provides a structured breakdown of the numeric value for further processing or analysis.
Arguments
num
(string | number
): The input number or string to parse.
Returns
(object)
: An object containing the following properties:float
(number): The absolute value of the parsed float.int
(number): The absolute value of the parsed integer.sign
(string): The sign of the number as a string ("-" for negative numbers, "" for positive or zero).
Example
Usage
Notes
The
parseNumber
function extracts the float, integer, and sign components of the input number for further analysis or processing.It provides a structured representation of the numeric value, allowing for detailed examination of its components.
The function returns an object with the absolute float and integer values, along with the sign of the number as a string.
Last updated
Was this helpful?