JSFiddle - React, Tailwind, and code Playground
JavaScript
const testArray = [
{foo: 1, bar: 'a'},
{foo: 2, bar: 'b'},
{foo: 3, bar: 'c'},
{foo: 4, bar: 'd'},
{foo: 5, bar: 'e'},
{foo: 6, bar: 'f'},
{foo: 7, bar: 'g'},
{foo: 8, bar: 'h'},
{foo: 9, bar: 'i'},
{foo: 10, bar: 'j'},
]
const newArray = []
testArray.map(item => {
const example = testArray.find(item => item.foo & 2)
newArray.push(item)
})
console.log(newArray)