Javascript


#1

Hello what's wrong ?
switch (film) {
case 1"Toy Story 2":
return"Bon film, j'adore les cowboys !";
break;
case 2 "Nemo":
return"Bonne animation, les tortures sont cool";
break;
case 3"Le Roi Lion":
return"Super musiques";
break;
default:
return "Je ne sais pas !";

}
}


#2

HI all the switch statement should be inside a function


#3

like this ???
var retour = function (film) {

switch (film) {
case 1"Toy Story 2":
return"Bon film, j'adore les cowboys !";
break;
case 2 "Nemo":
return"Bonne animation, les tortures sont cool";
break;
case 3"Le Roi Lion":
return"Super musiques";
break;
default:
return "Je ne sais pas !";

}
}
};


#4

Yes.. if you get an arror what does it says..?


#5

there was a problem with your syntax


#6

To your case

case 1"Toy Story 2":
case 2 "Nemo":
case 3"Le Roi Lion":

you should remove the numbers 1, 2, 3 then at tehend you have more } than you need remove one


#7

he say verified answer of Nemo


#8

It says that when the string you put in the return statement isn't liek the one they gave you
to Nemo you write

return "Bonne animation, les tortures sont cool";

you wrote tortures instead of tortues


#9

i wrote this and he say verified answer of Nemo

case "Nemo":
return"Bonne animation, les tortues sont cool";


#10

try it like that

return "Bonne animation, les tortues sont cool.";

in your's it's missing the dot after cool


#11

Thx a lot bro !!!! :slight_smile: