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

178
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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