12.
What does the Math.ceil() function return when given a negative number?
Returns the negative number rounded down to the nearest whole number.
Returns the negative number rounded up to the nearest whole number.
Returns the smallest integer that is less than or equal to the negative number.
Returns the largest integer that is greater than or equal to the negative number.
Correct: D
The Math.ceil() function behaves the same way with negative numbers as it does with positive numbers. It returns the next largest integer regardless of the sign of the provided number. For example:
const number = -5.75;
const roundedUp = Math.ceil(number);
console.log(roundedUp); // Output: -5