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

148
Views
Most efficient way to find if array contains specific element

I need a function that returns true/false if the array contains specific element or not. There are some functions such:

arr.includes(element)

that is not support IE 11.

arr.some(el => el === element)
arr.filter(el => el === element)[0]

that are supported IE 11.

But what are the best solution? Is there any more efficient way for instance by using binary search? Or any of those work with approximately perfect efficient? Any little contribution for efficient with wider browser support is attractive.

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

0

I think the best way for IE 11 :

function include(arr,obj) {
    return (arr.indexOf(obj) != -1);
}
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!