const nums = [1, 2, 3, 4, 5, 6]; const evens = _.reject(nums, num => num % 2 !== 0); console.log(evens); // [2, 4, 6]
const students = { john: {grade: 'A', major: 'math'}, kelly: {grade: 'B', major: 'english'}, tom: {grade: 'C', major: 'history'}, jane: {grade: 'A', major: 'biology'}, }; const goodStudents = _.reject(students, student => student.grade !== 'A'); console.log(goodStudents); // {john: {grade: 'A', major: 'math'}, jane: {grade: 'A', major: 'biology'}}In this example, `_reject()` is used to filter out all the students who didn't get an 'A' grade. The resulting `goodStudents` object contains only the students with an 'A' grade. The `_reject()` function is part of the Underscore library, which is available as a standalone package or as part of other popular JavaScript libraries like Backbone and Marionette.