ES6_ array expansion

ES6 added to the array many ways:

  • find (callback): find an example of an array of methods for finding the first matching array members. Its argument is a callback function, all members of the array in order to execute the callback function until you find the first member of a return value of true, then returned to the members. If there are no qualified members, returns undefined.

  • findIndex (callback): findIndex array method and find an example of the use method is very similar to the array member returns the first matching position condition, if all the members are not eligible, or -1.

  • includes (array elements): and find similar, if matched element, it returns true, the representative found.

Guess you like

Origin www.cnblogs.com/Tunan-Ki/p/11848418.html