I don’t know how it is possible for the number to have the last 5 digits … I will be very grateful for the help!
const num = 1666297292886;
//result
1666297200000
>Solution :
Adapt the 100000 with the same number of zeros you want.
Remove the last 5 zeros: divide by 1 and 5 zeros (100,000):
const num = 1666297292886;
const roundedDownResult = num - (num % 100000);
console.log(roundedDownResult);
const num = 1666297292886;
for (let i = 0; i < 10; i++) {
var precisionFactor = Math.pow(10, i);
console.log(num - (num % precisionFactor ));
}
If you want the opposite (the last 5 digits), use the following.
const num = 1666297292886;
const lastDigits = num - (Math.floor(num / 100000) * 100000);
console.log(lastDigits);