How to convert the last 3 digits of the number? Numbers will be bigger then 8000.
From 249439 to 249000?
You can get the last three digits using the modulus operator
%, which (for positive numbers) computes the remainder after integer division; for example,
249439 % 1000 is
So to round down to the nearest thousand, you can just subtract those three digits:
var rounded = original - original % 1000;
(for example, if
rounded will be