Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jacob Warmup challenge #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
52 changes: 52 additions & 0 deletions assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ console.log('Problem 1:')

// Add your code below this line

function multiplicationTable(number) {
for (let i = 0; i < 13; i++) {
console.log(number * i)
}
}

multiplicationTable(2)

// Add your code above this line

console.log('')
Expand Down Expand Up @@ -66,6 +74,17 @@ console.log('Problem 2:')

// Add your code below this line

let values1 = [57, 13, 4, 38]
let values2 = [3, 48, 29, 12, 18]

function maxnum(array) {
console.log(Math.max(...array));
}

maxnum(values1)
maxnum(values2)


// Add your code above this line

console.log('')
Expand Down Expand Up @@ -113,6 +132,39 @@ console.log('Problem 3:')

// Add your code below this line

function rockPaperScissors(playerA, playerB) {
let result = ""

if (playerA === playerB) {
result = "tie"
} else if (playerA === "rock") {
if (playerB === "paper") {
result = "playerB wins!"
} else {
result = "playerA wins!"
}
} else if (playerA === "paper") {
if (playerB === "scissors") {
result = "playerB wins!"
} else {
result = "playerA wins!"
}
} else if (playerA === "scissors") {
if (playerB === "rock") {
result = "playerB wins!"
} else {
result = "playerA wins!"
}
}
console.log(result)
}

rockPaperScissors("rock", "paper")
rockPaperScissors("scissors", "scissors")
rockPaperScissors("scissors", "paper")



// Add your code above this line

console.log('')
Expand Down