M7 IA1 Task1 Exercise2 Irene Arroyo

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



let dice = 0;
confirm(‘Do you want to throw the dice?’);

let throwDice = () => {
dice = Math.floor(Math.random() * 6 )+ 1;

alert (dice);}


window.location.href = window.location.href


Exercise 2 | Dice