remove object in array javascript

JavaScript
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 myArr = [{id:'a'},{id:'myid'},{id:'c'}];
var index = arr.findIndex(function(o){
     return o.id === 'myid';
})
if (index !== -1) myArr.splice(index, 1);//1
someArray.shift(); // first element removed
//2
someArray = someArray.slice(1); // first element removed
//3
someArray.splice(0, 1); // first element removed
//4
someArray.pop(); // last element removed
//5
someArray = someArray.slice(0, a.length - 1); // last element removed
//6
someArray.length = someArray.length - 1; // last element removedsomeArray.splice(x, 1);
Source

Also in JavaScript: