Created
June 16, 2021 12:22
-
-
Save adebisi-fa/7b5c673e68308f348019ca28d02cd813 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testSpeed(speed) { | |
if (speed <= 70) return { ok: true, speed } | |
var points = Math.floor((speed - 70) / 5) | |
if (points < 12) return { ok: false, speed, points } | |
return { ok: false, speed, message: 'License Suspended.', points } | |
} | |
;[80, 70, 120, 130, 75, 84, 92, 123, 129].forEach((speed) => { | |
console.log(testSpeed(speed)) | |
console.log('') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment