Не ми се получава задачата в JS-Advanced-Exercises, DOM Introduction - Exercise 8-ма задача
https://judge.softuni.bg/Contests/Compete/Index/2761#7
нещо не разбирам защо не ми се получава. ето кода който аз написах
function generateReport() {
let headRowArray = Array.from(document.querySelector('thead tr').children);
let bodyRowArray = Array.from(document.querySelectorAll('tbody tr'));
let textArea = document.getElementById('output');
let indices = [];
let employees = [];
for(let i = 0; i < headRowArray.length; i++){
if(headRowArray[i].children[0].checked === true){
indices.push(i);
}
}
for(let i = 0; i < bodyRowArray.length; i++){
let eInfo = {};
let tdArray = Array.from(bodyRowArray[i].children);
for(let j = 0; j < indices.length; j++){
let key = headRowArray[indices[j]].textContent.toLowerCase();
let value = tdArray[indices[j]].textContent;
eInfo[key] = value;
}
employees.push(eInfo);
}
let str = JSON.stringify(employees);
textArea.textContent = str;
}
Моя код 100/100 --> https://pastebin.com/JEP3Me95