JavaScript(JS) math method - round

The round method in JavaScript's Math object returns the value of a number rounded to the nearest integer. If the decimal portion of the number is less than 0.5, the number is rounded down to the nearest integer. If the decimal portion of the number is greater than or equal to 0.5, the number is rounded up to the nearest integer.

Here's an example usage:

re‮ef‬r to:theitroad.com
const num = 2.7;
const rounded = Math.round(num);
console.log(rounded); // 3

In the above example, the Math.round method is used to round the number 2.7 to the nearest integer. The result, which is 3, is then logged to the console.