Use Array.prototype.forEach instead of $.each