diff --git a/01week/rockPaperScissors.js b/01week/rockPaperScissors.js index 16f58790a..9e6a6e4be 100644 --- a/01week/rockPaperScissors.js +++ b/01week/rockPaperScissors.js @@ -10,9 +10,32 @@ const rl = readline.createInterface({ function rockPaperScissors(hand1, hand2) { - // Write code here - + // Rock paper Scissors function, below: + + if (hand1 === hand2){ + console.log("It's a tie.") + }; + if (hand1 === 'rock' && hand2 === 'scissor') { + console.log("User1 wins.") + }; + if (hand1 ==='rock'&& hand2 === 'paper'){ + console.log("User2 wins.") + }; + if (hand1 === 'paper'&& hand2 === 'rock') { + console.log("User1 wins.") + }; + if (hand1 === 'paper' && hand2 === 'scissors'){ + console.log("User2 wins.") + }; + if (hand1 === 'scissors' && hand2 === 'paper'){ + console.log("User1 wins.") + }; + if (hand1 === 'scissors'&& hand2 === 'rock'){ + console.log("User2 wins.") + }; } +rockPaperScissors("rock","paper"); + function getPrompt() { rl.question('hand1: ', (answer1) => { @@ -48,4 +71,6 @@ if (typeof describe === 'function') { getPrompt(); + + } diff --git a/02week/pigLatin.js b/02week/pigLatin.js index 046434c94..508d661f9 100644 --- a/02week/pigLatin.js +++ b/02week/pigLatin.js @@ -7,12 +7,16 @@ const rl = readline.createInterface({ output: process.stdout }); +//added pigLatin code function pigLatin(word) { - // Your code here -} + word= word.toLowerCase(); + let vowels = word.search(/[aeiuo]/); + console.log(word.substring(vowels) + word.substring(0,vowels) + "ay") + } + pigLatin("car"); function getPrompt() {