maplol123@gmail.com,
let inp;
let answered = document.getElementById("answered");
let allque = document.getElementById("allque");
answered.value = 0;
////взятие файла с сервера
function checkright() {
fetch("http://localhost:3000/public/data.json")
.then((response) => {
return response.json();
})
////сама проверка чекбоксов
.then((data) => {
inp = Array.from(document.querySelectorAll("div"),
div => Array.from(div.querySelectorAll('[type="checkbox"]'),
({checked}, i) => checked ? ++i : 0)
.filter(a => a));
answered.value = data.filter(({correct}, i) => JSON.stringify(correct) === JSON.stringify(inp[i])).length
allque.value = `из ${data.length}`;
console.log(answered.value);
});
}