Skip to content

Instantly share code, notes, and snippets.

@DATADEER
Last active September 12, 2020 16:17
Show Gist options
  • Save DATADEER/f1faa6e612b8f8f4e391c509e741774a to your computer and use it in GitHub Desktop.
Save DATADEER/f1faa6e612b8f8f4e391c509e741774a to your computer and use it in GitHub Desktop.
# parses and sums up durations of each episode from the designacademy.io course
# paste into console on https://www.designacademy.io/lesson/welcome-to-the-course/
Array.from(document.querySelectorAll('.note'))
.map((elem) => elem.innerText)
.map((text) => text.split('|')[1])
.filter((exists)=>exists)
.map((text)=> text.trim().split(':')
.map((number) => parseInt(number))
.reduce((acc,curr,i)=>i===0 ? acc + (curr * 60): acc + curr ,0))
.reduce((acc,curr)=>acc+curr,0 )/60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment