How do you find the decimal part of a float?
Using the modulo ( % ) operator
The % operator is an arithmetic operator that calculates and returns the remainder after the division of two numbers. If a number is divided by 1, the remainder will be the fractional part. So, using the modulo operator will give the fractional part of a float.
How do you extract the decimal part of a number?
Use the modulo (%) operator to get the decimal part of a number, e.g. const decimal = num % 1 .