Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

291
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda