Section 6 "help"


#1

var comparar=function(if)eleccion1==="piedra"){
if (eleccion2==="tijera") {
if (eleccion2==="papel") {
return "piedra gana";
} else {
return "papel gana";
}
};


#2

Hola Daniel,

What is going on here? var comparar=function(if)eleccion1==="piedra"){

From the previous lesson hint:

Your code should look something like this:
var comparar = function(eleccion1, eleccion2) {


#3

var comparar=function(eleccion1,eleccion2){
if (eleccion1==="piedra") {
if (eleccion2==="tijera") {
return "piedra gana";
} else {
return "papel gana";
}

SyntaxError: missing } after function body


#4

This should be else if

And you are missing two closing } at the end, one for function and the other for else if


#5

........Thank you.......:relaxed:


#6

2 posts were split to a new topic: RockRock, paper and scissors