9.How do you round the number 7.25, to the nearest whole number?
-
Math.round(7.25)
-
round(7.25)
-
rnd(7.25)
-
Math.rnd(7.25)
JavaScript's Math object provides the round() method for rounding numbers. Math.round(7.25) correctly rounds to 7. The round() function alone is not a global function in JavaScript - it must be called via the Math object.
To round a number to the nearest whole number, you can use the Math.round() function.
Option A) Math.round(7.25) - This option is correct because the Math.round() function returns the value of a number rounded to the nearest integer. In this case, 7.25 will be rounded to 7, which is the nearest whole number.
Option B) round(7.25) - This option is incorrect because there is no standalone round() function in JavaScript. You need to use the Math.round() function.
Option C) rnd(7.25) - This option is incorrect because there is no rnd() function in JavaScript. You need to use the Math.round() function.
Option D) Math.rnd(7.25) - This option is incorrect because there is no Math.rnd() function in JavaScript. You need to use the Math.round() function.
The correct answer is Option A) Math.round(7.25) because it correctly rounds the number 7.25 to the nearest whole number.