Advertisement
Guest User

Untitled

a guest
Jun 20th, 2013
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. function behavior(config) {
  4.   return function () {
  5.     if (config.verbose) {
  6.       console.log('I AM SCREAMING!');
  7.     } else {
  8.       console.log('i am a bit more polite');
  9.     }
  10.   }
  11. }
  12.  
  13. var talk = behavior({verbose: true});
  14. talk();
  15.  
  16. --------------------------------------------
  17.  
  18.  
  19. function behavior2(config) {
  20.   if (config.verbose) {
  21.     console.log('I AM SCREAMING!');
  22.   } else {
  23.     console.log('i am a bit more polite');
  24.   }
  25. }
  26.  
  27. var talk = behavior2.bind(null, {verbose: true});
  28. talk();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement