Files
small-javascript-projects/monty_hall.js
2025-07-23 16:32:12 +02:00

21 lines
384 B
JavaScript

const choices = {
choice0: false,
choice1: false,
choice2: false
};
const getRandomChoice = (max) => {
return Math.floor(Math.random() * max);
}
const setTrue = () => {
let randValue = getRandomChoice(3);
let key = `choice${randValue}`
choices[key] = true;
}
setTrue();
// let userChoice = prompt("Quelle porte choisissez-vous ? 1, 2 ou 3 ? ", 2);
if