1var arr = [{id: 1, name: "Person 1"}, {id:2, name:"Person 2"}];
2
3// Find item index using _.findIndex (thanks @AJ Richardson for comment)
4var index = _.findIndex(arr, {id: 1});
5
6// Replace item at index using native splice
7arr.splice(index, 1, {id: 100, name: 'New object.'});
8
9// "console.log" result
10document.write(JSON.stringify( arr ));