Guest User

Untitled

a guest
Jan 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. const printLove = (name) => {
  2. let result = 'Con amor ' + name;
  3. return result;
  4. }
  5.  
  6. const limitFunction = (cb, n) => {
  7. return (...args) => {
  8. if(n > 0){
  9. n--;
  10. return cb(...args);
  11. }
  12. return null
  13. }
  14. }
  15.  
  16.  
  17. const sayLove = limitFunction(printLove, 2);
  18.  
  19. console.log(sayLove('german'));
  20. console.log(sayLove('german'));
Add Comment
Please, Sign In to add comment