Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Convert an array-like object in to an array...

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var actualArray = toArray(obj);

Parameters

ParameterTypeMandatoryDescriptionAPI Version
objVariant(tick)

An array-like object, for example the 'arguments' object within a function scope.

1.0

Return value

ValueTypeNotesAPI Version
<array>ArrayAn array containing the numeric keys and their values from the "obj" passed in to toArray()1.0
<error>ErrorAn error, most likely an invalid object was passed in to toArray().1.0

Example

Code Block
themeRDark
languagejavascript
linenumberstrue
function foo() {
	arguments = toArray(arguments);
	var lastArg = arguments.pop();
}
Div
classbox
Availability
Status
colourGreen
titleStable

Requires:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

Globals

Topics:

Child pages (Children Display)
alltrue
depthall
pageGlobals
excerpttrue

Div
classbox

See also

Related articles: