Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

Filter by list of Ids

let activeIds = [202, 204]
let serviceList = [{  
                "id":201,
                "title":"a"
               },
               {  
                "id":202,
                "title":"a"
               },
               {  
                "id":203,
                "title":"c"
               },
               {  
                "id":204,
                "title":"d"
               },
               {  
                "id":205,
                "title":"e"
               }];


let  arr = serviceList.filter(function(item){
      return activeIds.indexOf(item.id) != -1;
    });
    
console.log(arr);

Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Filter #list #Ids
ADD COMMENT
Topic
Name
8+3 =