Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. steps = (stepsCount, footprintLength, speed) => {
  2.  
  3. let distance = stepsCount * footprintLength
  4. const tens = (n) => n > 9 ? n : '0' + n
  5. time = (((distance / 1000) / speed) * 60 + Math.floor(distance / 500))
  6. const hours = Math.floor(time / 60)
  7. const mins = Math.floor(time)
  8. const secs = Math.round((Math.ceil(((time % mins) * 100)) / 100) * 60)
  9. console.log(`${tens(hours)}:${tens(mins)}:${tens(secs)}`)
  10.  
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement