I don't understand what's wrong in my code?


#1

My last step for build "rock, paper, scissors"

else if (! choix1 === "papier", "ciseaux", "pierre") {
if (Choix2 === "papier", "ciseaux", "pierre"!) {
return "s'il vous plaît choisir une option";
}
else {
return "vous choisissez rien";
}
}
};

console.log (comparer (choixUtilisateur, choixOrdi));


#2

Next step in solving this is to identify in what way it behaves differently from what's intended. You may have already figured this out, but if you don't explain the situation you're stuck in, then I don't know what I'm helping you with.


#3

yes i understand but i don't what write in my code

this my code and i block

var choixUtilisateur = prompt("Choisissez-vous pierre, feuille, ou ciseaux ?");
var choixOrdi = Math.random();
if (choixOrdi < 0.34) {
choixOrdi = "pierre";
} else if(choixOrdi <= 0.67) {
choixOrdi = "feuille";
} else {
choixOrdi = "ciseaux";
} console.log("Ordinateur : " + choixOrdi);

var comparer = function (choix1, choix2) {
if (choix1 === choix2) {
return "Egalité !";
}
else if (choix1 === "pierre") {
if (choix2 === "ciseaux") {
return "pierre gagne"
}
else {
return "feuille gagne"
}

}
else if (choix1 === "feuille") {
    if (choix2 === "pierre") {
    return "feuille gagne"
}
else {
    return "ciseaux gagnent"
}}

else if (choix1 === "ciseaux") {
if (choix2 ==="pierre") {
return "pierre gagne"
}
else {
return "ciseaux gagne"
}
}
}
console.log("choixUtilisateur; choixOrdi");


#4

That still does not explain what the problem is!
What is your code doing differently from what you want it to be doing?