Skip to content

Instantly share code, notes, and snippets.

@Geruhn
Last active December 22, 2015 00:29
Show Gist options
  • Save Geruhn/6389735 to your computer and use it in GitHub Desktop.
Save Geruhn/6389735 to your computer and use it in GitHub Desktop.
JavaScript: Custom Each mit Callback Quelle: http://www.sitepoint.com/jquery-vs-raw-javascript-3-events-ajax/
function Each(obj, fn) {
if (obj.length) for (var i = 0, ol = obj.length, v = obj[0]; i < ol && fn(v, i) !== false; v = obj[++i]);
else for (var p in obj) if (fn(obj[p], p) === false) break;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment