Underscore.js _.functions() Method

Beginner
5 min read
Updated: Nov 2026
4 examples
Object

Definition

Returns a sorted list of the names of every method in an object — every function property (official Underscore docs).

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

Syntax

Call _.functions. Start with this line.

Underscore
_.functions(object)
CallWhat it does
_.functions(object)Primary signature.
_.functions(...)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
_.functions(object)

Parameters

ParameterDescription
objectRequired. Object to inspect

Return Value

Return ValueDescription
*Sorted array of method name strings

Underscore.js Examples

Example 1 — List Methods on a Plain Object

Non-function properties are skipped; names are sorted.

Underscore
var obj = {
  zed: function () {},
  age: 10,
  alpha: function () {}
};

_.functions(obj);
// → ["alpha", "zed"]
Try It Yourself

How It Works

  1. Scan. Each property is checked with typeof === "function".
  2. Skip. age is a number — not included.
  3. Collect. zed and alpha are method names.
  4. Sort. Result is alphabetical: alpha before zed.

Example 2 — Official: Methods on _

The docs use Underscore itself as the object to introspect.

Underscore
var names = _.functions(_);
names.slice(0, 4);
// → ["after", "all", "allKeys", "any"]

_.contains(names, "map");
// → true
Try It Yourself

How It Works

  1. Introspect. _ exposes many function properties.
  2. Sorted list. Names start alphabetically (after, all, …).
  3. Sample. slice(0, 4) shows the first four for readability.
  4. Check. map is among the method names.

Example 3 — Inherited Methods Included

Unlike _.keys, prototype function properties are listed too.

Underscore
var proto = { greet: function () {} };
var child = Object.create(proto);
child.wave = function () {};

_.functions(child);
// → ["greet", "wave"]

_.keys(child);
// → ["wave"]
Try It Yourself

How It Works

  1. Own. wave is defined on child.
  2. Inherited. greet lives on the prototype.
  3. functions. Collects both, then sorts.
  4. keys. Only own enumerable keys — wave alone.

Example 4 — _.functions vs _.keys

Same object — method names vs all own keys.

Underscore
var api = {
  version: 1,
  run: function () {},
  stop: function () {}
};

_.functions(api);
// → ["run", "stop"]

_.keys(api);
// → ["version", "run", "stop"]
Try It Yourself

How It Works

  1. functions. Keeps only function properties; sorts them.
  2. keys. Lists every own enumerable key, including version.
  3. Order. keys is not alphabetically sorted like functions.
  4. Pick. Need actions → functions; need all fields → keys.

Browser & Runtime Support

_.functions / _.methods 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

_.functions()

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
_.functions 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]).

Frequently Asked Questions

_.functions(object) returns a sorted array of the names of every function-valued property on the object (and its prototypes). It returns names as strings, not the functions themselves.
_.methods is an alias for _.functions — the same function.
Yes. The result is sorted alphabetically, not in definition order.
Yes. Unlike many Underscore object helpers, _.functions walks the prototype chain and includes inherited function properties.
_.keys lists own enumerable property names (any type). _.functions lists only function property names (own and inherited), sorted.
No. It returns a new array of name strings.

Next: _.findKey()

Find the key of the first value that passes a predicate.

_.findKey() tutorial →

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