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

287
Views
Error: Uncaught TypeError: data.every() is not a function

I tried to delete an array of array within an array if certain values existed

But I am getting this error

Error: Uncaught TypeError: data.every() is not a function

code below -- which worked for me in an online compiler

const data = [
  ['true', 'visiting-today', 'DVM-Wiessman', 'J-001'],
  ['false', 'visiting-tommorrow', 'DVM-Stevens', 'K-001'],
  ['true', 'visiting-tommorrow', 'DVM-Stevens', 'Z-001'],
  ['false', 'visiting-tommorrow', 'DVM-Kon', 'J-001']
]

const del_values = ['J-001', 'K-001'];

function remove_from_list(list, deleted_values) {
  return list.filter(data => data.every(el => !deleted_values.includes(el)))
}

console.log(remove_from_list(data, del_values))

I have also tried replacing includes with .indexOf() and .includes() but also get a similar error

Uncaught TypeError: data.indexOf is not a function

Uncaught TypeError: data.includes is not a function

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

0

The code you've provided works, you can test it in your browser's console.

The problem is you're trying to use Array methods on a variable that isn't an Array, so it's not recognizing those functions. if you're returning an answer with Fetch API make sure you add await/async or .then().

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!