Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

filter a object array tree javascript

const filterData = (data : any, id : any) => data.filter((o : any) => {
  if (o.children) o.children = filterData(o.children, id);
  return o.id != id
})

const searchResult = filterData(tasks, "Task 1")
 
PREVIOUS NEXT
Tagged: #filter #object #array #tree #javascript
ADD COMMENT
Topic
Name
5+2 =