Home > Web Front-end > JS Tutorial > body text

Introduction to the use of concat() method of arrays in javascript_javascript skills

WBOY
Release: 2016-05-16 17:08:25
Original
1265 people have browsed it
Copy code The code is as follows:



< ;title>Concat() method of array

<script> <br>/* <br>Concat() method of array: <br>1. This method will not change the current state of the array. array, only a copy of the concatenated array is returned. <br>2. Return a new array. The array is generated by adding all arrayX parameters to arrayObject. <br>If the argument to concat() operation is an array, then the elements in the array are added, not the array. <br>*/ <br><br>var arr1 = [123,"aaa"]; <br>var arr2 = [false,333]; <br>var arr3 = [true,"ddd"]; <br>//You can continue to connect arrays or other elements<br>document.write(arr1.concat(arr2,arr3,"vvv") "<br/>");//123,aaa,false,333,true ,ddd,vvv <br>//The original array has not changed<br>document.write(arr1);//123,aaa <br></script>








Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template