js

2019-02-22  本文已影响0人  ori_76bf

function doSomething(name) {

      console.log('Hello, ' + name);

}

function loggingDecorator(wrapped) {

          return function () {

                   console.log('Starting');

                      console.log("arguments", arguments)

                   const result = wrapped.apply(this, arguments);

                     console.log('Finished');

                     return result;

           }

}

var argu = 'top';

var wrapp = loggingDecorator(doSomething);

wrapp(argu);

上一篇下一篇

猜你喜欢

热点阅读