From ddaaef650a51fbf965b24f0b5dddb092895be25e Mon Sep 17 00:00:00 2001 From: christinarone <96158586+christinarone@users.noreply.github.com> Date: Thu, 24 Mar 2022 18:20:06 -0500 Subject: [PATCH] complete --- main.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/main.js b/main.js index e98b0914..f94e0e46 100644 --- a/main.js +++ b/main.js @@ -13,6 +13,34 @@ const rl = readline.createInterface({ // the function that will be called by the unit test below const rockPaperScissors = (hand1, hand2) => { + hand1 = hand1.trim().toLowerCase() + +hand2 = hand2.trim().toLowerCase() + + + if(hand1 === hand2) { + return "It's a tie!" + } + + if(hand1 === "rock" && hand2 === "paper"){ + return "Hand two wins!" + } + + if(hand1 === "rock" && hand2 === "scissors"){ + return "Hand one wins!" + } + + if(hand1 === "scissors" && hand2 === "rock"){ + return "Hand two wins!" + } + + if(hand1 === "paper" && hand2 === "rock"){ + return "Hand one wins!" + } + + if(hand1 === "paper" && hand2 === "scissors"){ + return "Hand two wins!" + } // Write code here // Use the unit test to see what is expected