Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Enregistrer le code
Ctrl+Alt+A
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <body> <h1>JavaScript Math</h1> <h2>La méthode Math.random()</h2> <p>Every time you click the button, getRndInteger(1, 10) returns a random whole number between 0 and 9 (both included):</p> <button onclick="document.getElementById('demo').innerHTML = getRndInteger(0,10)">Cliquez sur moi</button> <p id="demo"></p> <script> function getRndInteger(min, max) { return Math.floor(Math.random() * (max - min)) + min; } </script> </body> </html>