Skip to content

Instantly share code, notes, and snippets.

@adebisi-fa
Created June 16, 2021 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adebisi-fa/7b5c673e68308f348019ca28d02cd813 to your computer and use it in GitHub Desktop.
Save adebisi-fa/7b5c673e68308f348019ca28d02cd813 to your computer and use it in GitHub Desktop.
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