Skip to content

Instantly share code, notes, and snippets.

@superdark1999
Forked from shivaluma/avg.js
Created February 6, 2023 06:10
Show Gist options
  • Select an option

  • Save superdark1999/55f57e1ab8ae141a24a21564d99b2034 to your computer and use it in GitHub Desktop.

Select an option

Save superdark1999/55f57e1ab8ae141a24a21564d99b2034 to your computer and use it in GitHub Desktop.
Tinh diem trung binh hcmus
// tinh diem trung binh hcmus, vao trang diem va paste vao console.
// khong tinh anh van, quoc phong, the duc va nhung mon rot
var tinchi = document.querySelectorAll("td:nth-child(3)");
var monhoc = document.querySelectorAll("td:nth-child(2)");
var diem = document.querySelectorAll("td:nth-child(6)");
var tongdiem = 0,
tongtinchi = 0;
for (var i = 1; i < tinchi.length; i++) {
if (
monhoc[i].innerText.includes("Thể dục") ||
monhoc[i].innerText.includes("Anh văn") ||
monhoc[i].innerText.includes("Giáo dục") || !Number(diem[i].innerText) || Number(diem[i].innerText) < 5
) {
continue;
}
tongdiem += Number(tinchi[i].innerText) * Number(diem[i].innerText);
tongtinchi += Number(tinchi[i].innerText);
}
console.log("Tong tin chi : " + tongtinchi);
console.log("Diem trung binh : " + tongdiem / tongtinchi);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment