Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions 01week/rockPaperScissors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -48,4 +71,6 @@ if (typeof describe === 'function') {

getPrompt();



}
8 changes: 6 additions & 2 deletions 02week/pigLatin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down