The elements in the array increase the push usage unshift () method and the reduce pop () method

Source: Internet
Author: User

Push usage
Push English [P??] Beauty [P??]
Vt. to push forward;
Vt. By to promote or increase; Right... To exert pressure and persecution; Convince
N. Push, resolve; Large-scale offensive; Committed to the pursuit of
Definition and usage

The push () method adds one or more elements to the end of the array and returns the new length.

Grammar
Arrayobject.push (Newelement1,newelement2,...., newelementx)
return value

Adds the specified value to the new length after the array. (using document.write (arrayobject. push (Newelement1,newelement2,...., newelementx)) , Pop-up new arrayobject length value)

Unshift () method
Unshift English [? n '?? FT] Beauty [? n '?? FT]
Vi. Loosen the font Shift key of the typewriter or keyboard;

The Unshift () method adds one or more elements to the beginning of the array and returns the new length. (The Unshift () method does not work correctly in Internet Explorer !) )

Basically the same as the push method, but push is used for trailing increments

Pop () method
Pop English [p?p] Beauty [Pɑ:p]
Vi. To appear (in the field, suddenly); to appear suddenly; To make a burst sound; (sudden) Action;
Vt. To reach out (suddenly); (suddenly) raise a question; (Put something ready) out of the blue; Tap
N. Pop music; Soda (especially as a salutation) dad; (of a quick mark);

The Pop () method is used to delete and return the last element of the array.

Definition and usage

The Pop () method is used to delete and return the last element of the array.

Grammar
Arrayobject.pop ()
return value

The last element of the Arrayobject.

Description

The Pop () method removes the last element of the arrayobject, reducing the length of the array by 1, and returning the value of the element it deletes. If the array is already empty, pop () does not change the array and returns the undefined value.

The push () method adds its parameter order to the tail of the arrayobject. It modifies the arrayobject directly, rather than creating a new array. The push () method and the Pop () method use the advanced post-stack functionality provided by the array

The elements in the array increase the push usage unshift () method and the reduce pop () method

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.