JS Array has to say some things

Source: Internet
Author: User

1.Array is dynamically expandable, look, you can push data into the array all the time.

2. You can add an array to a string by using the Join method.

3. Four methods in the array: Push,pop,shift,unshift.

  1. Push: Add data to the last face;
  2. Pop: The array finally presents the data;
  3. Shift: The array front end takes out the data;
  4. Unshift: Adding data to the front of the array;
4. Other easily confusing methods in the array:
  1. Slice (INDEX1,INDEX2): intercepts an array with the arguments passed in, containing the previous not included.
  2. Splice: Can pass in 3 parameters, there are 3 functions
  • Delete: The parameter is 2,splice (index,num): The first parameter is where to start, and the second represents the number of items deleted.
  • Add: The parameter is greater than 3, and the second parameter is 0: When the first argument starts, the third argument is passed in, and of course the parameter is more than 3.
  • Replace: The parameter is greater than 3, and the second parameter is absolutely not 0, where the first argument starts, the second is the number of items to be deleted, the original substitution is to delete the old one, and then insert the new, the remaining parameters are the parameters to be inserted.

JS Array has to say some things

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.