Piedra Papel o Tijera. Punto 7


#1



https://www.codecademy.com/es/courses/javascript-beginner-es-ETSkG/1/3?curriculum_id=50d3cc1bca413c863600126d


No consigo que funcione en el punto 7. Totalmente perdido.


var comparar=function(eleccion1, eleccion2){
    if(eleccion1===eleccion2){
        return "¡Es un empate!";
    } else if (eleccion1==="piedra") {
        if (eleccion2==="tijeras") {
            return "piedra gana";
        } else {
            return "papel gana";
        }
    } else if (eleccion1==="papel") {
        if (eleccion2==="piedra") {
            return "papel gana";
        } else {
            return "papel gana";
        }
    }
}


#2

Please include a link to the exercise. Thanks.

Incluya un enlace al ejercicio. Gracias.


#3

Creo que ahora ya esta puesto el enlace. Gracias.

I think the link is now established. Thank you.


#4

My lesson submssion for this exercise has three if's after the first one.


In the very first inception of this module (lang=en) it was possible to use if because the return logic afforded it. Some time later the auther decided else if should be enforced, one supposes in the event no return takes place. At any length, things don't convey quite as they should to the learner. The pointillism is lost on them.

Hpefully the learner is forgiving and accepts the challenge it must be to even put these lessons up for us. On the more meaningful track, it looks like the translation took place before the english language course was revised so the expectation of, else if is not there. Now the expectation not being there might be causing a riff. Just guessing, mind.


#5

thanks for all.

Gracias por todo


#6

Escribo el código como lo he solucionado

var comparar=function(eleccion1, eleccion2){
if(eleccion1===eleccion2){
return "¡Es un empate!";
}
if (eleccion1==="piedra") {
if (eleccion2==="tijeras") {
return "piedra gana";
}
else {
return "papel gana";
}
}
else if (eleccion1==="papel") {
if (eleccion2==="piedra") {
return "papel gana";
}
else {
return "tijeras gana";
}
}
}