Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- steps = (stepsCount, footprintLength, speed) => {
- let distance = stepsCount * footprintLength
- const tens = (n) => n > 9 ? n : '0' + n
- time = (((distance / 1000) / speed) * 60 + Math.floor(distance / 500))
- const hours = Math.floor(time / 60)
- const mins = Math.floor(time)
- const secs = Math.round((Math.ceil(((time % mins) * 100)) / 100) * 60)
- console.log(`${tens(hours)}:${tens(mins)}:${tens(secs)}`)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement