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

207
Visualizações
I'm having a hard time understanding why this is returning x is not a function

I'm having a hard time understanding why this is returning "5Style is not a function"

NationalLevelCategoriesChosenList = [
  ["5Style", "5MelodyHarmony", "5RhythmTempo", "5TextureStructureForm", "5Timbre"]
], [
  []
];

if (NationalLevelCategoriesChosenList[0].some("5Style")) {
  console.log("working")
}

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The some() function allows you to test a value with a provided function. I think you want to use includes() instead ? Please see snippet below.

NationalLevelCategoriesChosenList = [
  ["5Style", "5MelodyHarmony", "5RhythmTempo", "5TextureStructureForm", "5Timbre"]
], [
  []
];


if (NationalLevelCategoriesChosenList[0].includes('5Style')){
  console.log("working")
 }

about 4 years ago · Juan Pablo Isaza Relatório

0

See the documentation for some:

The some() method tests whether at least one element in the array passes the test implemented by the provided function.

The argument you are passing "5Style" is a string, not a function.

You are probably looking for the includes method:

NationalLevelCategoriesChosenList[0].includes("5Style")

But if you wanted to use some then you need to write a function:

NationalLevelCategoriesChosenList[0].some((current_value) => curent_value === "5Style")
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