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

197
Views
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 answers
Answer question

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 Report

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 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!