js

作者: ori_76bf | 来源:发表于2019-02-22 17:05 被阅读0次

    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);

    相关文章

      网友评论

          本文标题:js

          本文链接:https://www.haomeiwen.com/subject/esneyqtx.html