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

171
Visualizações
how to filter array with includes an array

here is my first array

let specificCoin = ["Ethereum","Bitcoin"]

and here is the second one

 let coins =[
    {
        name: 'Bitcoin',
    },
    {
        name: 'Ethereum',
    },
    {
        name: 'Solana',
    },
    {
        name: 'BinanceCoin',
    }]

i wondering how can i filter the coins array with includes in specificCoin array something like that:

coins.filter(a => { return a.name.includes(specificCoin) })

result: [{name: 'Ethereum',},{name: 'Bitcoin'}]

and i also would like to know if there are two same objects value how can i get both in it, using this code

let dataAssest = data.map(b => b.assestSymbol.toLowerCase())
    let filtered = coins.filter(coin => dataAssest.includes(coin.symbol))

image of result: Wrong result

but that ain’t work, i hope you guys can give a good solution :)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Other way around

let specificCoin = ['ETH', 'BTC'].map(symbol => symbol.toLowerCase())

let coins = [{ id: 'Bitcoin', symbol: 'btc' }, { id: 'Ethereum', symbol: 'eth' }, { id: 'Solana', symbol: 'sol'}, { id: 'BinanceCoin', symbol: 'bnb'  }];

const filtered = coins.filter(coin => specificCoin.includes(coin.symbol.toLowerCase()))

console.log(filtered)

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