A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/Array/concat below:

concat · WebPlatform Docs

concat Summary

Combines two or more arrays.

Syntax
concat([ item1 [, item2 [, . . . [, itemN ]]]])
item1,. . ., itemN
Optional. Additional items to add to the end of array1.
Examples

The following example shows how to use the concat method when used with an array:

var a, b, c, d;
 a = new Array(1,2,3);
 b = "dog";
 c = new Array(42, "cat");
 d = a.concat(b, c);
 document.write(d);

 
 1, 2, 3, "dog", 42, "cat"
Remarks

The concat method returns an Array object containing the concatenation of array1 and any other supplied items.

The items to be added ( item1 itemN ) to the array are added, in order, starting from the first item in the list. If one of the items is an array, its contents are added to the end of array1. If the item is anything other than an array, it is added to the end of the array as a single array element.

Elements of source arrays are copied to the resulting array as follows:

See also Specification

[15.4.4.4 Array.prototype.concat ( [ string1 [ , string2 , … ] ] )] ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4