typescript/javascript remove object partial repetition in nested array of objects

I have nested array of objects that looks like this:

const nestedArray = [
   [{ id: 1 }, { id: 2 }, { id: 3 }],
   [{ id: 1 }, { id: 2 }]
]

Since objects with id 1 and 2 are already together in nestedArray‘s first element I want to remove the second element to have this as result:

const nestedArray = [
   [{ id: 1 }, { id: 2 }, { id: 3 }],
]

How do I write a filter function by id to get the expected result?

110 thoughts on “typescript/javascript remove object partial repetition in nested array of objects”

  1. First off I would like to say wonderful blog! I had a
    quick question which I’d like to ask if you don’t mind.
    I was interested to find out how you center yourself and clear
    your head before writing. I have had trouble clearing my thoughts in getting my thoughts out.
    I do take pleasure in writing but it just seems like the first
    10 to 15 minutes are lost simply just trying to figure out how to begin. Any suggestions
    or hints? Appreciate it!

    Reply
  2. Just wish to say your article is as astounding. The clearness on your put up is simply excellent and that i can think you are a
    professional on this subject. Fine along with
    your permission let me to grasp your feed to stay updated with impending post.
    Thank you a million and please continue the gratifying work.

    Reply
  3. I am really loving the theme/design of your site.

    Do you ever run into any browser compatibility problems?
    A number of my blog audience have complained about my blog not working correctly in Explorer but looks great in Safari.
    Do you have any suggestions to help fix this issue?

    Reply
  4. Good day! I know this is kinda off topic however I’d figured I’d ask.
    Would you be interested in exchanging links or maybe guest
    authoring a blog post or vice-versa? My site covers a lot of the same subjects as yours and
    I feel we could greatly benefit from each other. If you’re interested feel
    free to shoot me an e-mail. I look forward to hearing from you!

    Terrific blog by the way!

    Reply
  5. Wow that was strange. I just wrote an incredibly long comment but after I
    clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyway, just
    wanted to say excellent blog!

    Reply
  6. Hi, i read your blog from time to time and i own a similar one and i was just wondering
    if you get a lot of spam responses? If so how do you prevent it, any plugin or anything you can recommend?
    I get so much lately it’s driving me insane so any support is very much appreciated.

    Reply
  7. Hey there! This post couldn’t be written any better! Reading through this
    post reminds me of my previous room mate! He always kept chatting about this.
    I will forward this article to him. Pretty sure he will have a good read.
    Many thanks for sharing!

    Reply
  8. Somebody essentially help to make significantly posts
    I’d state. That is the first time I frequented your web
    page and up to now? I amazed with the research
    you made to create this actual publish amazing. Magnificent job!

    Reply
  9. May I simply just say what a relief to discover an individual
    who actually understands what they are discussing online.
    You definitely understand how to bring a problem to light and make it important.
    A lot more people have to read this and understand
    this side of the story. It’s surprising you aren’t more popular
    since you certainly possess the gift.

    Reply
  10. I’m extremely impressed with your writing talents and
    also with the structure in your weblog. Is this a paid
    subject or did you modify it yourself? Either way keep up the
    nice quality writing, it is rare to peer a great weblog like this one
    these days..

    Reply
  11. Greetings, There’s no doubt that your web site may be having browser compatibility issues.

    When I look at your site in Safari, it looks fine however, if opening in Internet Explorer, it’s got some
    overlapping issues. I simply wanted to give you a quick heads up!

    Besides that, wonderful website!

    Reply
  12. Hello there, I discovered your web site
    via Google while looking for a related topic, your website
    got here up, it seems good. I have bookmarked it in my google bookmarks.

    Hi there, simply was alert to your blog through Google, and located that it is really informative.
    I’m gonna be careful for brussels. I’ll appreciate in the event you proceed this in future.

    Lots of people will probably be benefited from your
    writing. Cheers!

    Reply
  13. Hi there! Someone in my Myspace group shared this site with us so I came to look
    it over. I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers!
    Excellent blog and outstanding design and style.

    Reply
  14. We are a group of volunteers and starting a new scheme in our community.

    Your website provided us with valuable information to work on.
    You’ve done a formidable job and our whole community will
    be thankful to you.

    Reply

Leave a Comment