how to find and remove object from array in javascript

JavaScript
 // we have an array of objects, we want to remove one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
 
// get index of object with id:37
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
 
// remove object
apps.splice(removeIndex, 1);const array = [
  { id: 1, name: 'serdar' },
  { id: 5, name: 'alex' },
  { id: 300, name: 'brittany' }
];
const idToRemove = 5;

const filterArray = array.filter((item) => item.id !== idToRemove);  //ES6

// [
//   { id: 1, name: 'serdar' },
//   { id: 300, name: 'brittany' }
// [var id = 88;

for(var i = 0; i < data.length; i++) {
    if(data[i].id == id) {
        data.splice(i, 1);
        break;
    }
}someArray.splice(x, 1);var id = 88;

for(var i = 0; i < data.length; i++) {
    if(data[i].id == id) {
        data.splice(i, 1);
        break;
    }
}

Source

Also in JavaScript: