foreach icon indicating copy to clipboard operation
foreach copied to clipboard

Added "break" and "continue" features

Open LeoOnTheEarth opened this issue 11 years ago • 0 comments

In the callback function, we can use the return value (false / true) to control for loop's "break" and "continue" features.

// break & continue
each([1,2,3], function (value, key, array) {
    if (1 === value) {
        // continue loop
        return true;
    }

    if (2 === value) {
        // break loop
        return false;
    }
});

LeoOnTheEarth avatar Aug 11 '15 19:08 LeoOnTheEarth