function welcome(username) { console.log('welcome ' + username); } function goodbye(username) { console.log('goodbye ' + username); } function wrapWithUsername(wrappedFunc) { let newFunc = () => { let username = localStorage.getItem('username'); wrappedFunc(username); }; return newFunc; } welcome = wrapWithUsername(welcome); goodbye = wrapWithUsername(goodbye); welcome(); goodbye();