Round off in javascript

Round off after decimal

const number = 3.14159265;
const rounded = Math.round(number);
console.log(rounded); // Outputs: 3

In the example, the constant number holds the value 3.14159265. When the Math.round() method is called with number as its argument, it returns the rounded value 3.

You can use the Math.round() method to round a number to a specified number of decimal places.
 For example, to round a number to 2 decimal places, you can multiply the number by 100, round it, and then divide it by 100:

and so on ..