---
id: 6925e2068081f40f549ced1d
title: "Challenge 139: Rock, Paper, Scissors"
challengeType: 28
dashedName: challenge-139
---

# --description--

Given two strings, the first representing Player 1 and the second representing Player 2, determine the winner of a match of Rock, Paper, Scissors.

- The input strings will always be `"Rock"`, `"Paper"`, or `"Scissors"`.
- `"Rock"` beats `"Scissors"`.
- `"Paper"` beats `"Rock"`.
- `"Scissors"` beats `"Paper"`.

Return:

- `"Player 1 wins"` if Player 1 wins.
- `"Player 2 wins"` if Player 2 wins.
- `"Tie"` if both players choose the same option.

# --hints--

`rockPaperScissors("Rock", "Rock")` should return `"Tie"`.

```js
assert.equal(rockPaperScissors("Rock", "Rock"), "Tie");
```

`rockPaperScissors("Rock", "Paper")` should return `"Player 2 wins"`.

```js
assert.equal(rockPaperScissors("Rock", "Paper"), "Player 2 wins");
```

`rockPaperScissors("Scissors", "Paper")` should return `"Player 1 wins"`.

```js
assert.equal(rockPaperScissors("Scissors", "Paper"), "Player 1 wins");
```

`rockPaperScissors("Rock", "Scissors")` should return `"Player 1 wins"`.

```js
assert.equal(rockPaperScissors("Rock", "Scissors"), "Player 1 wins");
```

`rockPaperScissors("Scissors", "Scissors")` should return `"Tie"`.

```js
assert.equal(rockPaperScissors("Scissors", "Scissors"), "Tie");
```

`rockPaperScissors("Scissors", "Rock")` should return `"Player 2 wins"`.

```js
assert.equal(rockPaperScissors("Scissors", "Rock"), "Player 2 wins");
```

# --seed--

## --seed-contents--

```js
function rockPaperScissors(player1, player2) {

  return player1;
}
```

# --solutions--

```js
function rockPaperScissors(player1, player2) {
  if (player1 === player2) return "Tie";

  if (
    (player1 === "Rock" && player2 === "Scissors") ||
    (player1 === "Paper" && player2 === "Rock") ||
    (player1 === "Scissors" && player2 === "Paper")
  ) {
    return "Player 1 wins";
  } else {
    return "Player 2 wins";
  }
}
```
