How to use Split in Javascript _ basic knowledge

Source: Internet
Author: User
In Javascript, the Split method is rarely used in the past. I have found some materials today.
Usage: myArray = string. split ("| ")
Note: "|" indicates the feature character to be cut, string indicates the string to be cut, and myArray indicates the cut result (stored in an array). Use myArray [n] and n = myArray. length.
At first, I used the thinking in asp to think about how to get the maximum subscript of myArray. It must not be Ubound (myArray). I did not find it for a long time, and finally I got it, in fact, arrays in Javascript have a length attribute, myArray. length-1 is the maximum subscript of the myArray array. It's easy to think about it.
Let's look at an example using split: use javascript to get the address bar parameters.

The Code is as follows:


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.