Программист объясняет каждую |
function createStudent(student) {
const $studentTr = document.createElement('tr'),
$btnDelete.classList.add('btn','btn-outline-danger')
$studentFIO.textContent = student.StudentFIO;
$studentAge.textContent = student.getBirthDate() + ' (' + student.getAge() +' лет)';
$studentstudyStart.textContent = student.studyStart + '-' + student.endEduc + ' (' + student.getYearsEduc() + ')';
$studentFaculty.textContent = student.faculty;
$btnDelete.textContent = 'Удалить';
$studentTr.append($studentFIO);
$studentTr.append($studentAge);
$studentTr.append($studentstudyStart);
$studentTr.append($studentFaculty);
$studentTr.append($btnDelete);
function createStudent(student) {
const $studentTr = document.createElement('tr'),
$btnDelete.classList.add('btn','btn-outline-danger')
$studentFIO.textContent = student.StudentFIO;
$studentAge.textContent = student.getBirthDate() + ' (' + student.getAge() +' лет)';
$studentstudyStart.textContent = student.studyStart + '-' + student.endEduc + ' (' + student.getYearsEduc() + ')';
$studentFaculty.textContent = student.faculty;
$btnDelete.textContent = 'Удалить';
$studentTr.append($studentFIO);
$studentTr.append($studentAge);
$studentTr.append($studentstudyStart);
$studentTr.append($studentFaculty);
$studentTr.append($btnDelete);
$btnDelete.addEventListener('click', async function() {
console.log(student);
await serverDeleteStudent(student.id);
$studentTr.remove();
})
console.log($studentTr);
return $studentTr;
}