Creation of arrays in JavaScript add and convert arrays to strings

Source: Internet
Author: User
Tags array to string

Creating a JS Array

var array=new array ();

Creating Arrays in Java

Private string[] Array=new string[3];

Two completely different, JS is variable-length

Add content

Array.push (something);

In Java

array[0]= "ABC";

Array to String

Array.join (",")

In Java

String str=arrays.tostring (array);

Related application code:

functionDoDelete () {//determine if the record is selected    varrows = $ ("#grid"). DataGrid ("Getselections"); if(rows.length===0) {$.messager.alert (' System Information ', ' Please select at least one record operation! ', ' warning '); }Else{        //ask if you want to delete$.messager.confirm (' System info ', ' Confirm the deletion? ‘,function(r) {if(r) {//creating a JS Array object                varArray =NewArray (); //submit a Delete request to submit multiple IDs to the server side                 for(vari=0;i<rows.length;i++){                    varCourierid =rows[i].id; //The push () method adds one or more elements to the end of the array and returns the new lengthArray.push (Courierid); }                //use the Join () method to compose all elements of an array into a string.                 varids = Array.join (","); Window.location.href= "${pagecontext.request.contextpath}/courieraction_deletebantch.action?ids=" +IDs; }        })    }}

Creation of arrays in JavaScript add and convert arrays to strings

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.