Remove an item from array using UnderscoreJS Remove an item from array using UnderscoreJS javascript javascript

Remove an item from array using UnderscoreJS


Just using plain JavaScript, this has been answered already: remove objects from array by object property.

Using underscore.js, you could combine .findWhere with .without:

var arr = [{  id: 1,  name: 'a'}, {  id: 2,  name: 'b'}, {  id: 3,  name: 'c'}];//substract thirdarr = _.without(arr, _.findWhere(arr, {  id: 3}));console.log(arr);
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>