JSFiddle - React, Tailwind, and code Playground
by vasi_32
JavaScript
var messages = [
{id: 1, replyTo: null},
{id: 5, replyTo: null},
{id: 7, replyTo: null},
{id: 9, replyTo: 7},
{id: 10, replyTo: null},
{id: 12, replyTo: 1},
{id: 16, replyTo: 1},
{id: 20, replyTo: 1},
{id: 24, replyTo: 1},
{id: 28, replyTo: 1},
{id: 32, replyTo: 1},
{id: 36, replyTo: 1},
{id: 40, replyTo: 1}
];
var newArray = messages.filter(function(item){
return item.id !==1
})
var newArray2 = newArray.filter(function(item){
return item.replyTo !==1;
})
console.log(newArray2);