Scripting _javascript techniques for composing strings of JavaScript array groups

Source: Internet
Author: User
Tags javascript array
In some programs, you might want to combine array groups into strings, such as the var aarray = ["A", "B", "C"], and the form of a string. Here are two ways, of course, if you have a better way, don't forget to leave a message to me.
First type:
aarray.tostring ()
The second type:
Aarray + ""
Demonstrate:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" > <ptml> <pead> ; <meta http-equiv= "Content-type" content= "text/html; Charset=iso-8859-1 "/> <title>js array Group synthesis string </title> <script language=" JavaScript "type=" t Ext/javascript "> var aarray = [" A "," B "," C "]; document.write (typeof (Aarray) + ""); document.write (typeof (Aarray.tostring ()) + ""); document.write (typeof (Aarray + "")); </script> </pead> <body> </body> </ptml>
[ctrl+a All selected note: If you need to introduce external JS need to refresh to perform]
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.