I have a method to return the result value,
---------
const values = 123.10000;
const result = i18n.n(values, 'number');
return result;
--------
In the above,I need to round off the result to 3 decimal point, I tired tofixed, rounD off method but the zeros are not be included in it.
expected output result is 123.100.
but i am getting 123.1
, how should i add the decimal round off method to 3 decimal digits with the values having zeros
Try use this.
The toFixed() method formats a number using fixed-point notation. ref
const values = 123.1;
const result = values.toFixed(3);
console.log(result);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.