Counts the number of decimal places in a numeric string.
The string representation of a number.
The number of decimal places. Returns 0 if there are no decimal places.
countDecimals('123.456'); // Returns 3countDecimals('123'); // Returns 0 Copy
countDecimals('123.456'); // Returns 3countDecimals('123'); // Returns 0
Counts the number of decimal places in a numeric string.