This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("Bienvenue dans ce jeu de devinette !"); | |
let solution = Math.floor(Math.random(1 < 100) * 100) + 1; | |
let NombreEssai; | |
for (NombreEssai = 0; NombreEssai < 6; NombreEssai++) { | |
let proposition = Number(prompt("Proposer un chiffre entre 1 et 100")); | |
if (proposition === solution) { | |
console.log("Bravo, la solution est " + solution + ". Vous avez trouvé en " + NombreEssai + " essai(s)"); | |
break; | |
} else if (proposition < solution) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.alert ("Bienvenue dans ce jeu de devinette !"); | |
function solution = Math.floor(Math.random(1 < 100) * 100) + 1; | |
window.alert("La solution est " + solution + "."); | |
function NombreEssai = NombreEssai; | |
for (NombreEssai = 6; NombreEssai <= 6; NombreEssai++) { | |
window.alert proposition = Number(prompt("Proposer un chiffre entre 1 et 100")); | |
if (proposition === solution) { | |
window.alert("Bravo, la solution est " + solution + "Vous avez trouvé en " + NombreEssai + "essai(s)"); |