"Flash ActionScript 3 Palace Road", chapter 12, array

Source: Internet
Author: User
Tags array length shallow copy


1.

(1) Assigning values to new array members using an index value that exceeds the "array length-1"
(2) The length of the force setting array is less than the current length, causing the array to be truncated.

2.

Basic operations for Arrays
  (1) Find: IndexOf (from left to right), lastIndexOf (right to Zocha)
    directly queries the index of the target array.  
 
Eg:
    destination array. indexOf (the element to find)
  destination array. lastIndexOf (the element to find)
 
  You can also define where to start the lookup.
 eg:
        destination array. indexOf (the element to find, the starting position of the lookup)
  target array. lastIndexOf (the element to find,      The starting position of the lookup)
 
 
 
(2) new element: Push (add one or more at the end), Unshift (add one or more in the header)
The push and Unshift methods return the array length after adding the element
 eg:
Array. Push (element 1, Element 2,...); An
array. unshift (element 1, Element 2,...);


(3) to delete the elements of the array: Pop (delete the last element), shift (the first element of the array is deleted, the remaining element index value is automatically minus 1)
Pop and shift return the deleted element
EG:
array. Pop ();
Array. Shift ();


(4) Splice: You can insert or delete elements in an array flexibly.
(5) Slice: Gets the partial element in the array.
Note: The difference between splice and slice.

(6) Concat: Combining multiple elements or arrays into a new array
Note: The difference between concat and push.

3.  

Deep copy and shallow copy of the array (note when the array elements are complex type data.) )



4.

Sort: Reverse,sort,sorton.


5.

Manipulate the values for each element: Foreach,every,filter,maparsefloat,some.

"Flash ActionScript 3 Palace Road", chapter 12, array

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.