NandhaGopalElangovan
NandhaGopalElangovan

Reputation: 229

rounding off to 3 decimal values for the value that uses i18n (regional setting) in vue.js - vue-i18n

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

Upvotes: 0

Views: 351

Answers (1)

Fred Dale
Fred Dale

Reputation: 34

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);

Upvotes: 0

Related Questions