Simple Dice Game

Simple Dice Game!

<p>Let's play a game of dice! The goal is to roll the highest number.</p>

<div>
    <button onclick='rollDice()'>Roll Dice</button>
    <p id='dice-result'></p>
</div>

<script>
    function rollDice() {
        let diceResult = Math.floor(Math.random() * 6) + 1;
        document.getElementById('dice-result').innerHTML = 'You rolled a ' + diceResult;
    }
</script>
Simple Dice Game: Roll the Highest Number - HTML Game

原文地址: https://www.cveoy.top/t/topic/lmlV 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录