How do I create a JavaScript random number generator with a range of 0-10?


I also have to list the number in the p tag num-display, and use an event listener to associate randomNum with num-display.

Respuesta :

tonb

Answer:

 randomInt(min: number, max: number): number {

   return Math.floor(Math.random() * (max - min + 1) + min);

 }

Explanation:

use randomInt(0,10) to get a number, with 0 and 10 inclusive.