We can make use of map and object destructing to achieve this:
map
const posts = [ { title: 'Cool', date: '2023', content: 'Happy New Year' }, { title: 'Awesome', date: '2022', content: 'Happy National Day' }, { title: 'Dope', date: '2014', content: 'Merry Christmas' }, ]; const filteredPost = posts.map((obj) => { const { date, ...rest } = obj; return rest; });
This will be the output:
[ { title: 'Cool', content: 'Happy New Year' }, { title: 'Awesome', content: 'Happy National Day' }, { title: 'Dope', content: 'Merry Christmas' }, ];