I have an array of strings:
["5:17", "8:22", "3:34", "5:23", "7:12", "7:24", "6:46", "4:45", "4:40", "7:58", "11:51", "9:13", "5:50", "5:52", "5:49", "8:57", "11:29", "3:07", "5:59", "3:31"]
How can I convert the strings to numbers?
I have an array of strings:
["5:17", "8:22", "3:34", "5:23", "7:12", "7:24", "6:46", "4:45", "4:40", "7:58", "11:51", "9:13", "5:50", "5:52", "5:49", "8:57", "11:29", "3:07", "5:59", "3:31"]
How can I convert the strings to numbers?
You can use "map" as below
arr.map(d => {
let [min, sec] = d.split(':')
return +min * 60 + +sec
})