AHJ George
String
:yearRegex
, recording the date stringintervalsRegex
parseDate
helper and the date string from step 2.Aconsole.log(times);
statement, you'll see an array containing objects like:Date.parse
.String.prototype.split
, which might not be unique depending on whether two days included the same time intervals.times
object. To optimize this code, it’d likely be better to use a single reduce over an empty object containing totalHours
and times
as fields.