Get Index in each function

If you use the index for any of the code while using _.each, You can get the index of the current iteration by adding another parameter to your iteratorĀ function

_.each([array], function (val, i) {
    //here val iterator function and i will be the index 
});

Leave a comment

Your email address will not be published. Required fields are marked *