I need to remove a line using for loop, for some reason splice didn't work..
The code is
for (let course of department_arr) {
for (let i in new_assignment_ls) {
if (course.CourseName == new_assignment_ls[i][3] &&
course.Semester == new_assignment_ls[i][4].split(' ').slice(1).join(' ') &&
course.Route == new_assignment_ls[i][5].split(' ').slice(1).join(' ')) { // check courses are equal to submitted
dataHtml += `<tr class='accordion' id="accordion" onclick="newAssign(this)"><td>${new_assignment_ls[i][0]}</td><td>${new_assignment_ls[i][1]}</td><td>${new_assignment_ls[i][2]}</td><td>${course.Year}</td><td>${course.Semester}</td><td>${course.Route}</td><td>${course.CourseName}</td></tr>`;
department_arr.splice(course, course);
}
}
dataHtml += `<tr class='accordion' id="accordion" onclick="newAssign(this)"><td></td><td></td><td></td><td>${course.Year}</td><td>${course.Semester}</td><td>${course.Route}</td><td>${course.CourseName}</td></tr>`;
}
the if works good and the output is good but for some reason it prints me the outcome of the if + the outcome in the else for the same line.
Can someone please advise?
nvm I've managed to solve the issue. I had an issue with the splice and I called back the array after the splice and it seems to work.
10x