1 month ago

Remove objects from array comparing with another array

Posted 1 month ago by Gabotronix

Hi everybody, I have an array blackList where I store blacklisted business names, now I have a results array of objects with many business, I want to store in an array the business names which are not included in the blackListed array, what is the easier and most performant way to do this?

Is a nested loop really needed for this?

blackList = [ "Dominos Pizza", "Domino's Pizza", "McDonald's", "McDonalds",  "Telepizza", "Subway", "Burger King", "KFC", "Pans&Co", "Pans&Company" ,
        "Rodilla", "Rodilla Campamento", "Granier", "Llaollao" , "Taco Bell", "Wendy's", "Dunkin' Donuts", "Pizza Hut", "Papa John's Pizza", "Little Caesars",
        "Panera Bread", "Chipotle", "Papa Murphy's", "Hungry Howie", "Chipotle Mexican Grill", "Starbucks"],
        list = [ { name:'business 1' }, { name:'business 2' }, { name:'business 3' } ]

Please sign in or create an account to participate in this conversation.