Parameters: This function accept a single parameter as mentioned above and described below:
- item: This parameter holds the collection item where any operation will be performed on the collection on items.
Return Type: Return a result after performing the define operator operation.
Below examples illustrate the each() function in collect.js
Example 1: Here in this example, we take a collection and then using the each() method , we apply + operation to the collection.
sum = 10