---
id: 691b559495c5cb5a37b9b487
title: "Challenge 127: Speed Check"
challengeType: 28
dashedName: challenge-127
---

# --description--

Given the speed you are traveling in miles per hour (MPH), and a speed limit in kilometers per hour (KPH), determine whether you are speeding and if you will get a warning or a ticket.

- 1 mile equals 1.60934 kilometers.
- If you are traveling less than or equal to the speed limit, return `"Not Speeding"`.
- If you are traveling 5 KPH or less over the speed limit, return `"Warning"`.
- If you are traveling more than 5 KPH over the speed limit, return `"Ticket"`.

# --hints--

`speedCheck(30, 70)` should return `"Not Speeding"`.

```js
assert.equal(speedCheck(30, 70), "Not Speeding");
```

`speedCheck(40, 60)` should return `"Warning"`.

```js
assert.equal(speedCheck(40, 60), "Warning");
```

`speedCheck(40, 65)` should return `"Not Speeding"`.

```js
assert.equal(speedCheck(40, 65), "Not Speeding");
```

`speedCheck(60, 90)` should return `"Ticket"`.

```js
assert.equal(speedCheck(60, 90), "Ticket");
```

`speedCheck(65, 100)` should return `"Warning"`.

```js
assert.equal(speedCheck(65, 100), "Warning");
```

`speedCheck(88, 40)` should return `"Ticket"`.

```js
assert.equal(speedCheck(88, 40), "Ticket");
```

# --seed--

## --seed-contents--

```js
function speedCheck(speedMph, speedLimitKph) {
  return speedMph;
}
```

# --solutions--

```js
function speedCheck(speedMph, speedLimitKph) {
  const speedKph = speedMph * 1.60934;

  if (speedKph <= speedLimitKph) {
    return "Not Speeding";
  }

  const over = speedKph - speedLimitKph;

  if (over <= 5) {
    return "Warning";
  }

  return "Ticket";
}
```
