How can you round a floating-point number to the nearest integer using JavaScript operators?

In JavaScript, you can round a floating-point number to the nearest integer using the `Math.round()` function or by using the combination of arithmetic operators. Let's explore both methods:

1. Using `Math.round()` Function:
The `Math.round()` function rounds a number to the nearest integer. It uses the standard rounding rules (rounding to the nearest integer, with ties rounding to the nearest even integer).

   let floatingNumber = 3.75;
   let roundedNumber = Math.round(floatingNumber);

   console.log(roundedNumber);  // Outputs: 4


2. Using Arithmetic Operators:
 You can use a combination of arithmetic operators to achieve rounding. For positive numbers, adding `0.5` and then using `Math.floor()` achieves the same effect as rounding.


   let floatingNumber = 3.75;
   let roundedNumber = Math.floor(floatingNumber + 0.5);

   console.log(roundedNumber);  // Outputs: 4


   For negative numbers, subtracting `0.5` and then using `Math.ceil()` achieves the rounding.

 
   let floatingNumber = -3.75;
   let roundedNumber = Math.ceil(floatingNumber - 0.5);

   console.log(roundedNumber);  // Outputs: -4


Choose the method that best fits your specific requirements. The `Math.round()` function is generally more concise and commonly used for rounding. It also handles ties in a consistent manner. However, the arithmetic approach might be useful in situations where you need fine-grained control over the rounding process.