学习extends扩展方法

Posted ttblog5

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了学习extends扩展方法相关的知识,希望对你有一定的参考价值。

  function _extends() {
    _extends = Object.assign || function (target) {
      for (var i = 1; i < arguments.length; i++) {
        var source = arguments[i];

        for (var key in source) {
          if (Object.prototype.hasOwnProperty.call(source, key)) {
            target[key] = source[key];
          }
        }
      }

      return target;
    };

    return _extends.apply(this, arguments);
  }

例子:最后给函数Revert添加了一个属性

技术图片

 

以上是关于学习extends扩展方法的主要内容,如果未能解决你的问题,请参考以下文章