Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. var _ = {
  2. map: function(list, cbFn) {
  3. var newArray = [];
  4. list.forEach(function(elem, index) {
  5. var newElem = cbFn(elem, index);
  6. newArray.push(newElem);
  7. });
  8. return newArray;
  9. }
  10. };
  11.  
  12. _.map([2, 4, 6], function(num){ return num / 2 ; });
  13.  
  14. [12, 5, 8, 300, 44].every(x => 4);
  15.  
  16. var even = _.find([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement