Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
Remove specific array in for loop using javascript

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!