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

181
Views
Check if values from an large Array are present in another large Array.(JavaScript)

It's an interview task that says: Lets imagine, you receive from the backend API 2 very large arrays with names. Your task is to check if values from array t are present in y. Please, explain your approach/es.

var t = ['toy1', 'toy2', 'toy3', ..., A];

var y = ['toy3', 'toy1'];


I want the best method and fastest to compare them, to return true or false or to return index.(whatever) assuming,that they are too large arrays.

Because we don't know if all the array elements are strings or objects(in var t). What is the best aproach?

The best aproach is if all array values are strings to do t.some( name => y.includes(name) );

about 4 years ago · Juan Pablo Isaza
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!