10.02.2018 Views

js_tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Javascript<br />

concat ()<br />

Javascript array concat() method returns a new array comprised of this array<br />

joined with two or more arrays.<br />

Syntax<br />

The syntax of concat() method is as follows:<br />

array.concat(value1, value2, ..., valueN);<br />

Parameter Details<br />

valueN : Arrays and/or values to concatenate to the resulting array.<br />

Return Value<br />

Returns the length of the array.<br />

Example<br />

Try the following example.<br />

<br />

<br />

JavaScript Array concat Method<br />

<br />

<br />

<br />

var alpha = ["a", "b", "c"];<br />

var numeric = [1, 2, 3];<br />

var alphaNumeric = alpha.concat(numeric);<br />

document.write("alphaNumeric : " + alphaNumeric );<br />

<br />

<br />

<br />

Output<br />

alphaNumeric : a,b,c,1,2,3<br />

183

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!