Underscore.js _.reject() Method

Beginner
5 min read
Updated: Nov 2026
4 examples
Collection

Definition

Returns the values in a list without the elements that pass the truth test — the opposite of _.filter (official Underscore docs). Stable Collection helper — not deprecated.

Pass the required arguments shown below. Underscore collection helpers usually return a new value — check whether the source is mutated.

Syntax

Call _.reject. Start with this line.

Underscore
_.reject(list, predicate)
CallWhat it does
_.reject(list, predicate)Primary signature.
_.reject(...)Call with the arguments your case needs.

Load Underscore with import _ from "underscore" (or the UMD CDN build) so these helpers are available as _.

Library declarations
Underscore
_.reject(list, predicate)

Parameters

ParameterDescription
listRequired. Collection to scan
predicateRequired. Function, property name, or matcher object
contextOptional. this for the predicate

Return Value

Return ValueDescription
*New array of failing values

Underscore.js Examples

Example 1 — Drop Even Numbers

Reject values that pass “is even” — keep the odds.

Underscore
var odds = _.reject([1, 2, 3, 4, 5, 6], function (num) {
  return num % 2 === 0;
});
// → [1, 3, 5]
Try It Yourself

How It Works

  1. Predicate. num % 2 === 0 means “even.”
  2. Drop passers. Evens match and are removed.
  3. Keep failures. Odds fail the test and stay.
  4. New array. Source [1…6] is unchanged.

Example 2 — Reject Active Users

Drop every record whose predicate is truthy.

Underscore
var users = [
  { name: "Ada", active: false },
  { name: "Linus", active: true },
  { name: "Grace", active: true }
];

_.reject(users, function (user) {
  return u.active;
});
// → [{ name: "Ada", active: false }]
Try It Yourself

How It Works

  1. Test active. Truthy users are “passers.”
  2. Drop Linus & Grace. They fail the reject keep-rule.
  3. Keep Ada. active: false fails the predicate.
  4. Shorthand tip. _.reject(users, "active") does the same.

Example 3 — Object Matcher Shorthand

Pass an object — matching items are removed.

Underscore
var items = [
  { name: "Apple", type: "fruit" },
  { name: "Carrot", type: "veg" },
  { name: "Mango", type: "fruit" }
];

_.reject(items, { type: "fruit" });
// → [{ name: "Carrot", type: "veg" }]
Try It Yourself

How It Works

  1. Matcher. { type: "fruit" } builds a property match.
  2. Drop matches. Apple and Mango are rejected.
  3. Keep the rest. Carrot stays in the result.
  4. No function. Shorthand covers common “remove these” cases.

Example 4 — reject vs filter

Same predicate, complementary halves.

Underscore
var nums = [1, 2, 3, 4, 5, 6];
var isEven = function (n) { return n % 2 === 0; };

_.reject(nums, isEven);  // → [1, 3, 5]
_.filter(nums, isEven);  // → [2, 4, 6]
Try It Yourself

How It Works

  1. One test. Both use “is even?”
  2. Reject. Keeps odds (failures).
  3. Filter. Keeps evens (passers).
  4. Together. Need both? Prefer _.partition.

Browser & Runtime Support

_.reject ships with Underscore.js (1.x). It runs anywhere Underscore runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install underscore.

✓ Stable · Underscore 1.x

_.reject()

Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.

100% With Underscore 1.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.reject Underscore 1.x+

Bottom line: Safe for production once Underscore is on the page or in your bundle. Not a native browser API — load Underscore first. Prefer a pinned CDN version (e.g. [email protected]). Native alternative: array.filter(x => !pred(x)).

Frequently Asked Questions

_.reject(list, predicate, [context]) returns a new array of every value that fails the truth test — the opposite of _.filter.
_.filter keeps truthy matches; _.reject keeps the rest. _.reject(list, pred) is like _.filter(list, _.negate(pred)).
You get an empty array. _.reject always returns an array.
No. Unlike _.filter (aliased as _.select), there is no alias for _.reject.
Yes. A string tests that property’s truthiness; an object acts as a matcher. Matching items are dropped.
Use _.partition when you need both the passers and the failers in one call. Use _.reject when you only need the failing half.

Next: _.every()

Return true only when every value passes the predicate.

_.every() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful