I think I need to come up with a better example in this case to show the partial application, as the underlying console.log only takes the one argument.
constdocLogger=mkLogger('DOCS',true);logger('LIBS','Direct log message',false);docLogger('This is my log message');docLogger('Another log message');functionlogger(route,message,showDate){constheader=showDate?`${newDate().toISOString()} | ${route}`:route;console.log(`${header} | ${message}`);}functionmkLogger(route,showDate=false){// Implement "partial application" with the values// in the closurereturn(message)=>logger(route,message,showDate);}
Thanks for writing this up - ill add it to the main article and shout you out!