10.
What does the Math.random() function in JavaScript do?
Reverses the order of the characters in a string.
Returns the square root of a given number.
Generates a random integer between two specified values.
Generates a random number between 0 and 1.
Correct: D
The Math.random() function in JavaScript generates a random number between 0 (inclusive) and 1 (exclusive). This function is commonly used to create random behavior in programs or to generate random numbers for games or simulations.
const randomNumber = Math.random();
console.log(randomNumber); // Outputs a random number between 0 and 1