Lodash remove to remove an object from the array based on an id property

Remove uses a predicate function. See example:

var friends = [{ friend_id: 3, friend_name: 'Jim' }, { friend_id: 14, friend_name: 'Selma' }];

_.remove(friends, friend => friend.friend_id === 14);

console.log(friends); // prints [{"friend_id":3,"friend_name":"Jim"}]
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.js"></script>


You can use filter.

var myArray = [1, 2, 3];

var oneAndThree = _.filter(myArray, function(x) { return x !== 2; });

console.log(allButThisOne); // Should contain 1 and 3.

Edited: For your specific code, use this:

friends = _.filter(friends, function (f) { return f.friend_id !== 14; });