curriculum/challenges/english/blocks/daily-coding-challenges-javascript/691b559495c5cb5a37b9b487.md
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.
"Not Speeding"."Warning"."Ticket".speedCheck(30, 70) should return "Not Speeding".
assert.equal(speedCheck(30, 70), "Not Speeding");
speedCheck(40, 60) should return "Warning".
assert.equal(speedCheck(40, 60), "Warning");
speedCheck(40, 65) should return "Not Speeding".
assert.equal(speedCheck(40, 65), "Not Speeding");
speedCheck(60, 90) should return "Ticket".
assert.equal(speedCheck(60, 90), "Ticket");
speedCheck(65, 100) should return "Warning".
assert.equal(speedCheck(65, 100), "Warning");
speedCheck(88, 40) should return "Ticket".
assert.equal(speedCheck(88, 40), "Ticket");
function speedCheck(speedMph, speedLimitKph) {
return speedMph;
}
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";
}