---
id: 69373793f5a867f769cde139
title: "Challenge 154: Par for the Hole"
challengeType: 28
dashedName: challenge-154
---

# --description--

Given two integers, the par for a golf hole and the number of strokes a golfer took on that hole, return the golfer's score using golf terms.

Return:

- `"Hole in one!"` if it took one stroke.
- `"Eagle"` if it took two strokes less than par.
- `"Birdie"` if it took one stroke less than par.
- `"Par"` if it took the same number of strokes as par.
- `"Bogey"` if it took one stroke more than par.
- `"Double bogey"` if took two strokes more than par.

# --hints--

`golfScore(3, 3)` should return `"Par"`.

```js
assert.equal(golfScore(3, 3), "Par");
```

`golfScore(4, 3)` should return `"Birdie"`.

```js
assert.equal(golfScore(4, 3), "Birdie");
```

`golfScore(3, 1)` should return `"Hole in one!"`.

```js
assert.equal(golfScore(3, 1), "Hole in one!");
```

`golfScore(5, 7)` should return `"Double bogey"`.

```js
assert.equal(golfScore(5, 7), "Double bogey");
```

`golfScore(4, 5)` should return `"Bogey"`.

```js
assert.equal(golfScore(4, 5), "Bogey");
```

`golfScore(5, 3)` should return `"Eagle"`.

```js
assert.equal(golfScore(5, 3), "Eagle");
```

# --seed--

## --seed-contents--

```js
function golfScore(par, strokes) {

  return par;
}
```

# --solutions--

```js
function golfScore(par, strokes) {
  if (strokes === 1) return "Hole in one!";

  const diff = strokes - par;

  if (diff === -2) return "Eagle";
  if (diff === -1) return "Birdie";
  if (diff === 0) return "Par";
  if (diff === 1) return "Bogey";
  if (diff === 2) return "Double bogey";
}
```
