Iterates an array or an iterable value and invoke the given callback function for each item.

var countries = ['Vietnam', 'Singapore', 'United States', 'Russia'];

Ext.Array.each(countries, function(name, index, countriesItSelf) {
console.log(name);
});

var sum = function() {
var sum = 0;

Ext.Array.each(arguments, function(value) {
sum += value;
});

return sum;
};

sum(1, 2, 3); // returns 6

The iteration can be stopped by returning false in the function callback.

Ext.Array.each(countries, function(name, index, countriesItSelf) {
if (name === 'Singapore') {
return false; // break here
}
});

{@link Ext#each Ext.each} is alias for {@link Ext.Array#each Ext.Array.each}

@param {Array/NodeList/Object} iterable The value to be iterated. If this
argument is not iterable, the callback function is called once.
@param {Function} fn The callback function. If it returns false, the iteration stops and this method returns
the current `index`.
@param {Object} fn.item The item at the current `index` in the passed `array`
@param {Number} fn.index The current `index` within the `array`
@param {Array} fn.allItems The `array` itself which was passed as the first argument
@param {Boolean} fn.return Return false to stop iteration.
@param {Object} scope (Optional) The scope (`this` reference) in which the specified function is executed.
@param {Boolean} reverse (Optional) Reverse the iteration order (loop from the end to the beginning)
Defaults false
@return {Boolean} See description for the `fn` parameter.
function(array, fn, scope, reverse) {
            array = ExtArray.from(array);

            var i,
                ln = array.length;

            if (reverse !== true) {
                for (i = 0; i < ln; i++) {
                    if (fn.call(scope || array[i], array[i], i, array) === false) {
                        return i;
                    }
                }
            }
            else {
                for (i = ln - 1; i > -1; i--) {
                    if (fn.call(scope || array[i], array[i], i, array) === false) {
                        return i;
                    }
                }
            }

            return true;
        }