[ACCEPTED]-Remove key from object/value using Lodash-lodash

Accepted answer
Score: 21

You can use remove() inside the forEach() to achieve the 2 result you want...

_(z).forEach(function (n) {
    _.remove(b, { 'name': n });
});

The code can be further 1 simplified by removing z and forEach()...

var a = _.filter(characters, { 'blocked': 'a' });
var b = _(characters)
            .difference(a)
            .reject(function (x) { 
                return _.where(a, { 'name': x.name }).length; 
            })
            .value();

JSFiddle

More Related questions