js filter array of objects by value

JavaScript
const myArray = [{id: 1, name:'pipi'}, {id: 2, name:'popo'}];
const id = 2;

const variableOne = myArray.filter(itemInArray => itemInArray.id === id);
console.log(cariableOne[0].name);let arr=[{id:1,title:'A', status:true}, {id:3,title:'B',status:true}, {id:2, title:'xys', status:true}];
//find where title=B
let x = arr.filter((a)=>{if(a.title=='B'){return a}});
console.log(x)//[{id:3,title:'B',status:true}]var heroes = [
	{name: “Batman”, franchise: “DC”},
	{name: “Ironman”, franchise: “Marvel”},
	{name: “Thor”, franchise: “Marvel”},
	{name: “Superman”, franchise: “DC”}
];

var marvelHeroes =  heroes.filter(function(hero) {
	return hero.franchise == “Marvel”;
});

// [ {name: “Ironman”, franchise: “Marvel”}, {name: “Thor”, franchise: “Marvel”} ]const data = [
  {
    name: 'Bob',
    gender: 'male',
    age: 34,
  },
  {
    name: 'Carol',
    gender: 'female',
    age: 36,
  },
  {
    name: 'Ted',
    gender: 'male',
    age: 38,
  },
  {
    name: 'Alice',
    gender: 'female',
    age: 40,
  },
];

const arr1 = data.filter(d => d.age > 37);
console.log('arr1', arr1);

const arr2 = data.filter(d => d.gender === 'female');
console.log('arr2', arr2);

const ageAndGender = d => d.age > 37 && d.gender === 'female';

const arr3 = data.filter(ageAndGender);
console.log('arr3', arr3);
var arr = [1,2,3,4],
    brr = [2,4],
    res = arr.filter(f => !brr.includes(f));
console.log(res);function isGreater(element, index, array) { 
   return (element >= 10); 
} 
          
let testElemets = [12, 5, 8, 130, 44].filter(isGreater); 
console.log("Test Value : " + testElemets );
Source

Also in JavaScript: