I have a database of sport results that looks like this:
const database = [{"distance in km": 10, "duration": "00:45:36", "pace": "00:04:34"}];
To calculate the
pace
value, I have to divide theduration
by thenumber of kilometers
, but how do I do that? Whatever method I try, it returnsNaN
.How do I perform calculations on multiple duration values? E.g. how do I get an average pace of three runs? (
0:05:22
,00:04:54
and00:05:05
should give an average of00:05:07
)