Creates a real Array from the list (anything that can be iterated over) (official Underscore docs). Useful for transmuting the arguments object. 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 _.toArray. Start with this line.
Underscore
_.toArray(list)
Call
What it does
_.toArray(list)
Primary signature.
_.toArray(...)
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
_.toArray(list)
Parameters
Parameter
Description
list
Required. Array-like, object, string, or iterable
Return Value
Return Value
Description
*
New real Array (shallow)
Underscore.js Examples
Example 1 — Official: Convert arguments
Turn the arguments object into an array, then slice.
_.toArray 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
_.toArray()
Available in [email protected] (UMD / ESM). Works in evergreen browsers and current Node LTS when Underscore is loaded.
100%With Underscore 1.x
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
_.toArrayUnderscore 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
_.toArray(list) creates a real Array from anything that can be iterated over. Official example: (function(){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4) → [2, 3, 4].
The arguments object is array-like but not a real array — it lacks many array methods. _.toArray makes a real array you can slice, map, and filter.
For plain objects both return the values as an array. _.toArray also handles arguments, NodeLists, strings, and other array-likes.
No. It is a shallow copy — nested objects stay shared references.
_.toArray(null) and _.toArray(undefined) return an empty array [].
Array.from does similar work in modern engines. _.toArray is the Underscore helper and stays handy inside Underscore chains.