Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert KM to Miles and round to 1 dp
distanceKM = 100
distanceMiles = distanceKM / 0.6 # => 166.66667
distanceMilesRounded = parseFloat(distanceMiles, 10).toFixed 1 # => 166.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment