How to filter data from one array based on another array

Suppose i have 2 array
arr1=["a","b","c","d","e"]
arr2 = [1,3]
Required output arr1 = ["b","d"]

106 thoughts on “How to filter data from one array based on another array”

  1. I assume that you want the value of the first array with the index provided in the second array. You can achieve that with the following approach

    arr2.forEach(value => d.push(arr1[value]))
    
    Reply
  2. I simply could not depart your site prior to suggesting that I really enjoyed the standard info a
    person provide for your guests? Is gonna be back frequently in order to check out new posts

    My blog – epicwin game (Twyla)

    Reply
  3. Hello very cool website!! Guy .. Excellent .. Amazing ..

    I’ll bookmark your site and take the feeds also? I’m glad to find a lot of useful information here within the put
    up, we’d like develop more strategies in this regard, thanks for sharing.
    . . . . .

    Feel free to visit my webpage … kiss test id

    Reply
  4. Saya telah menjelajah online lebih dari tiga jam hari ini, namun saya tidak pernah menemukan artikel menarik seperti milik Anda.
    It is cukup berharga bagi saya. Dalam pandangan saya, jika
    semua pemilik situs dan blogger membuat konten yang baik seperti yang Anda lakukan, web akan menjadi
    a jauh lebih berguna dari sebelumnya.

    Here is my page; King joker888 (Gameaco.com)

    Reply
  5. Saya akan segera genggam rss Anda karena saya tidak
    bisa
    Ini adalah waktu tepat untuk membuat beberapa rencana untuk masa depan dan sekarang waktu
    untuk bahagia. Saya punya pelajari kirim ini dan jika saya
    boleh saja saya ingin menyarankan Anda beberapa menarik hal atau tips.

    Mungkin Anda bisa menulis artikel berikutnya yang berhubungan dengan artikel ini.
    Saya ingin mempelajari lebih hal kira-kira itu!

    Here is my web page … Joker123 For Pc

    Reply
  6. Saya akan segera genggam rss Anda karena saya tidak bisa
    Sangat keren! Beberapa poin yang
    Saya menikmati apa yang kalian ada juga.
    Seperti pekerjaan cerdas dan liputan ! Pertahankan
    bagus karya kawan-kawan yang telah saya
    termasuk kalian ke
    Jika Anda ingin meningkatkan keakraban hanya terus mengunjungi halaman web dan diperbarui dengan terpanas gosip diposting
    di sini.

    Also visit my blog post – Jokerwin deposit pulsa

    Reply
  7. Hey! I know this is somewhat off-topic but I had to ask. Does managing a well-established website like yours
    require a massive amount work? I’m completely new to blogging but
    I do write in my diary every day. I’d like to start
    a blog so I can easily share my experience and feelings online.
    Please let me know if you have any recommendations or tips
    for brand new aspiring blog owners. Thankyou!

    Also visit my blog post: blitzflagfootball.com

    Reply
  8. Hi there! I know this is somewhat off topic but I was wondering which blog
    platform are you using for this website? I’m getting fed up
    of WordPress because I’ve had issues with hackers
    and I’m looking at alternatives for another platform. I would be awesome if you
    could point me in the direction of a good platform.

    Feel free to visit my website … Lonna

    Reply
  9. Its like you read my mind! You seem to know so much about this, like you wrote
    the book in it or something. I think that you can do with some pics to drive the message home a little bit, but other than that, this
    is fantastic blog. A fantastic read. I will certainly be back.

    My web-site; vadatahub.org

    Reply
  10. I simply wished to thank you very much once more.
    I do not know the things I might have sorted out in the absence of those hints
    shared by you on my theme. Entirely was the challenging case in my
    position, but noticing this expert form you solved that made
    me to leap with contentment. I am happier for this help
    and as well , have high hopes you realize what a powerful job that you are accomplishing instructing others by way of your website.
    I am sure you haven’t met any of us.

    Also visit my homepage; buildingabettercolorado.org

    Reply
  11. Wonderful items from you, man. I’ve take into account your stuff prior to and
    you’re just too great. I really like what you’ve
    acquired here, really like what you’re saying and the way in which you
    assert it. You’re making it entertaining and you still care for to
    keep it smart. I cant wait to read far more from you.
    That is actually a great site.

    Here is my site; rectherapydirectory.com

    Reply
  12. It is perfect time to make some plans for the future and it’s time to be happy.
    I’ve read this submit and if I could I want to counsel you few interesting things
    or suggestions. Maybe you could write next articles referring to this article.
    I wish to learn more issues about it!

    Reply
  13. I really wanted to jot down a small remark to say thanks to you for those awesome guidelines you are showing here.
    My extended internet lookup has at the end of the day been compensated with
    really good insight to talk about with my neighbours.
    I would express that we readers are extremely fortunate to live in a decent community with many brilliant individuals with very beneficial ideas.
    I feel truly grateful to have used your web site and look forward to so
    many more pleasurable minutes reading here. Thanks a lot once more for all the details.

    Have a look at my website :: http://www.shlgreencab.com

    Reply
  14. You’re so awesome! I do not think I have read through something like that before.
    So good to discover somebody with a few original thoughts on this topic.

    Seriously.. thanks for starting this up. This web
    site is something that is needed on the internet, someone with a little originality!

    Review my web site – trumaroonnation.net

    Reply
  15. Hey there just wanted to give you a brief heads up and let you know a few of the images aren’t loading correctly.

    I’m not sure why but I think its a linking issue. I’ve tried it in two different web browsers and
    both show the same results.

    Feel free to visit my homepage; latenightfights.net

    Reply
  16. You actually make it seem really easy along
    with your presentation but I to find this topic to be actually something which I believe I would by no
    means understand. It seems too complex and extremely extensive for
    me. I am having a look forward in your subsequent submit, I will attempt to get the hang
    of it!

    Feel free to visit my blog post … lovegamematch.com

    Reply
  17. Іt’s appropriate timе to make some plɑns for the future
    annd it’s time to be happy. I’ve read this post and if I сould I
    desire to sugggest you some interesting things or tips.
    Рerhaps you coᥙld write next articles referring to
    tһis article. I wish to read evеn mⲟre things about
    it!

    Reply
  18. Hοwdy! This article could not be written any better! Looking
    at this article reminds me of my previⲟսs roommate!

    He сߋntinuaⅼly kept preaching about this. I’ll forward this post to him.

    Pretty sure he’s going to have a good read. Thank you for sharing!

    Reply
  19. You really make it seem so easy with your presentation but I find this topic
    to be really something that I think I would never understand.

    It seems too complicated and very broad for me. I am looking forward for your next post, I’ll try to get the
    hang of it!

    Reply
  20. I believe this is one of the such a lot significant information for me.
    And i’m happy studying your article. But want to commentary on few
    basic things, The web site taste is perfect, the articles is really nice :
    D. Just right job, cheers

    Also visit my homepage freeholmes.com

    Reply
  21. I’m curious to find out what blog system you happen to be using?
    I’m experiencing some minor security problems with my latest site and I’d like
    to find something more safe. Do you have any solutions?

    Look into my homepage … 1stanapa.ru

    Reply
  22. Pretty nice post. I just stumbled upon your blog and wished
    to say that I’ve truly enjoyed browsing your blog posts.

    In any case I will be subscribing to your rss
    feed and I hope you write again soon!

    My blog … zo-azie.nl

    Reply
  23. I’m curious to find out what blog platform you happen to be using?
    I’m having some minor security issues with my latest site and I’d like to find something
    more safeguarded. Do you have any suggestions?

    Reply

Leave a Comment