fork download
  1. //Old days...
  2.  
  3. function PrefixLogger(prefix){
  4. return function(msg){
  5. console.log(prefix, msg);
  6. }
  7. }
  8.  
  9. var oldLogger = PrefixLogger('My Awesome Logger :');
  10.  
  11. oldLogger('a log message');
  12.  
  13. //Nowadays...
  14.  
  15. var nowLogger = console.log.bind(null,'My Awesome Logger :');
  16.  
  17. nowLogger('a log message');
Success #stdin #stdout 0.13s 26400KB
stdin
Standard input is empty
stdout
My Awesome Logger : a log message
My Awesome Logger : a log message