Skip to content

What metric is "averageSpeed"? #68

Answered by gregegan
Isaac-r-Johnson asked this question in Q&A
Discussion options

You must be logged in to vote

@Isaac-r-Johnson - it is returned in meters per second

const averageSpeedInMetersPerSecond = 1.6030000448226929;

// Conversion factors
const metersToMiles = 0.000621371;
const secondsToHours = 1 / 3600;

// Convert speed to miles per hour
const averageSpeedInMilesPerHour = averageSpeedInMetersPerSecond * metersToMiles / secondsToHours;

// Calculate pace in minutes per mile
const paceInMinutesPerMile = 1 / averageSpeedInMilesPerHour * 60;

console.log(`Mile Pace: ${Math.floor(paceInMinutesPerMile)}:${Math.round((paceInMinutesPerMile % 1) * 60).toString().padStart(2, '0')} per mile`);

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Isaac-r-Johnson
Comment options

Answer selected by Isaac-r-Johnson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants