by @saigowthamr

How to round 2 decimal places in JavaScript

Home » javascript » How to round 2 decimal places in JavaScript

In JavaScript, we have the toFixed() method by using that we can round a number to 2 decimal places.

Here is an example:

const num = 13.13456787654;
const twoDecimal = num.toFixed(2);

console.log(twoDecimal); // 13.34