["4", "5.67", "1:45.67", "4:43.45"]
I have this string array and i want to convert all of the strings to numbers with seconds format so it will become something like this
[4, 5.67, 105.67, 283.45]
how can i do it?
function hmsToSecondsOnly(str) {
var p = str.split(':'),
s = 0, m = 1;
while (p.length > 0) {
s += m * parseInt(p.pop(), 10);
m *= 60;
}
return s;
}
I found this but it seems to only work in MM:SS format like 1:40 but i want convert strings in x:xx.xx format