In this exercise, we must use functions to develop the activity, which implies creating a program that throws a dice and gives you a number from 1 to 6.
The following code is the one used in the exercise
Code
<html>
<head>
<script>
let dice = 0;
confirm(‘Do you want to throw the dice?’);
let throwDice = () => {
dice = Math.floor(Math.random() * 6 )+ 1;
alert (dice);}
throwDice();
window.location.href = window.location.href
</script>
</head>
<body>
</body>
</html>