This article mainly introduces the usage of some functions in detail, which is very practical. If you need them, you can refer to them.
This article mainly introduces the usage of some functions in detail, which is very practical. If you need them, you can refer to them.
Parameter description
Callback: the callback function to be executed for each array element.
ThisObject: this object defined when the callback function is executed.
Function Description
Execute a specified function (callback) for each element in the array until this function returns true. If this element is found, some returns true, if the callback function returns false after each element is executed, some returns false. It only executes the specified function for non-empty elements in the array, and no value is assigned or deleted elements are ignored.
The callback function can have three parameters: the current element, the index of the current element, and the current array object.
If the thisObject parameter is passed in, it will be used as the this object inside the callback function (callback). If it is not passed or is null, a global object will be used.
The Code is as follows: