Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var each = function(collection, cb) {
  2.       if (isArrayLike(collection)) {
  3.         for (var i = 0; i < collection.length; i++) {
  4.             cb.call(collection[i], i, collection[i]);
  5.         }
  6.       } else {
  7.         for (var prop in collection) {
  8.           cb.call(collection[prop], prop, collection[prop]);
  9.         }
  10.       }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement