Here is the simple solution with JavaScript:
function runningPace(distance, time) { if (distance === 1) { return time; } var timeArray = time.split(':'); var minute = Number(timeArray[0]) * 60 var seconds = Number(timeArray[1]) + minute seconds = Math.floor(seconds / distance); minute = Math.floor(seconds / 60); var second = seconds - minute * 60; if (second >= 0 && second <= 9) { second = "0" + String(second); } return minute + ":" + second; }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Here is the simple solution with JavaScript: