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

179
Visualizações
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 à 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