Skip to content

Instantly share code, notes, and snippets.

View hrishi7's full-sized avatar
🏠
Working from home

Hrishikesh Baidya hrishi7

🏠
Working from home
View GitHub Profile
@hrishi7
hrishi7 / splice-object-array.js
Created November 22, 2021 11:45 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
// we have an array of objects, we want to remove one object using only the id property
const apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id of 37
const removeIndex = apps.findIndex( item => item.id === 37 );
// remove object
apps.splice( removeIndex, 1 );