javascript - Build "Rock, Paper, Scissors" in code codecademy -


i learn basic js using codeacademy.

i in step 6 , 7 of "rock, paper, scrissors"

https://www.codecademy.com/courses/javascript-beginner-en-bthev-msky8/1/2?curriculum_id=506324b3a7dffd00020bf661  https://www.codecademy.com/courses/javascript-beginner-en-bthev-msky8/1/3?curriculum_id=506324b3a7dffd00020bf661 

i have wrote following code step 6 wrong gives me following error

oops, try again. code returned 'paper wins' instead of 'rock wins' when inputs rock , scissors  var compare = function(choice1, choice2) { if(choice1 === choice2) { return "the result tie!"; } else if(choice1 === "rock") {          if (choice2 === "scrissors") {             return "rock wins";         }         else {             return "paper wins";         } } }; console.log(compare('rock','scrissors')); console.log(compare('rock','rock')); console.log(compare('scissor','scissor')); console.log(compare('paper','paper')); console.log(compare('rock','paper')) 

and accept right answer in step 7.

what going wrong it?

update code:

var compare = function(choice1, choice2) { if(choice1 === choice2) { return "the result tie!"; } else if(choice1 === "rock") {          if (choice2 === "scrissors") {             return "rock wins";         }         else {             return "paper wins";         } } }; console.log(compare('rock','scrissors')); console.log(compare('rock','rock')); console.log(compare('rock','paper')) 

updated: ensure spell only: scissors not scrissors. codeacademy use internal validation tools check result , if don't spell correctly tool fail because you're not handling input they've told handle!

spelling mistake:

if (choice2 === "scrissors") { ... }  console.log(compare('rock','scrissors')); console.log(compare('scissor','scissor')); 

Comments