Skip to content

Instantly share code, notes, and snippets.

@pilzze
Created May 15, 2017 07:26
Show Gist options
  • Save pilzze/b3d2a595f00c47e4862060422bc55432 to your computer and use it in GitHub Desktop.
Save pilzze/b3d2a595f00c47e4862060422bc55432 to your computer and use it in GitHub Desktop.
var lessons = document.getElementsByClassName("lessons-left"); // get the lessons
var tempLessons = []; // temporary array
for(i=0; i<lessons.length; i++) {
tempLessons.push(lessons[i].innerText);//clean the html
}
lessons = tempLessons;//restore original array name
var s = 0; // initalize a var fo sum
for(i=0; i<lessons.length; i++) {
if (lessons[i] !== '') {//catch if nulled value
s+=parseInt(lessons[i][2]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment