Methods for traversing array elements

Source: Internet
Author: User

    • forEach(): No return value, only the specified function is called for each array item ( callbackfn )
    • every(): Returns a Boolean value ( true or false ) that determines whether each array item conforms to the condition of the specified function, conforms to true , and vice versa.false
    • some(): Returns a Boolean value ( true or false) that determines whether each array item conforms to the condition of the specified function, and returns if any of the items are returned as truetrue
    • filter(): Each array item invokes the specified function, and the condition is true returned to a new array
    • map(): Each array item invokes the specified function, returning the result of each function call to form a new array

In this five array iteration method, where forEach() , every() and some() methods do not generate a new array, filter() and the map() method will generate a new array (qualifying). And these methods will invoke the specified function callbackfn .

Original: http://www.w3cplus.com/javascript/array-part-7.html

Methods for traversing array elements

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.