Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda