Introduction to the concat () method of arrays in javascript _ javascript skills

Source: Internet
Author: User
The concat () method of arrays must be familiar to everyone. In this article, we will introduce the specific use of the concat () method of arrays in javascript. If you are interested, refer The Code is as follows:




Concat () method of Array

Script
/*
The concat () method of the array:
1. This method does not change the existing array, but only returns a copy of the connected array.
2. Return a new array. This array is generated by adding all arrayX parameters to arrayObject.
If the concat () operation parameter is an array, the elements in the array are added instead of an array.
*/

Var arr1 = [123, "aaa"];
Var arr2 = [false, 333];
Var arr3 = [true, "ddd"];
// You can continue to connect to arrays or other elements.
Document. write (arr1.concat (arr2, arr3, "vvv") +"
"); // 123, aaa, false, 333, true, ddd, vvv
// The original array is not changed.
Document. write (arr1); // 123, aaa
Script







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.