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

170
Views
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 answers
Answer question

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 Report
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!