Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

288
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda