Learn JS Basic article

Source: Internet
Author: User

1.push () and Unshift () returns the new array length after executing the method
When the pop () and Shift () methods are executed, the removed items are returned;

Shift () Gets the first pop () to get the last item

Push () adds item unshift () from the previous Add item

Memorizing method: The letter is short is to take an item, the letter is long is added, pop () is shorter than push (), so is to take, learn from each other;

Push () is added from the front. Unshift () is deleted from the back, the transmission parameters;

Pop () is the last item removed, and shift () removes the first item without parameters;

When the slice () method has only one parameter, the method returns all items that have the last value, including the final item,

When there are two parameters, the starting position (including) is returned to the item with the lowest value (not included).

Learn JS Basic 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.