Tekkaman

导航

 

new.target

  The new.target property lets you detect whether a function or constructor was called using the newoperator. In constructors and functions instantiated with the new operator, new.target returns a reference to the constructor or function. In normal function calls, new.target is undefined.

  new.target refers the constructor invoked by new.

  

  In class constructors, new.target refers to the constructor that was directly invoked by new. This is also the case if the constructor is in a parent class and was delegated from a child constructor.

  

参考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new.target

posted on 2017-02-09 16:35  Tekkaman  阅读(132)  评论(0编辑  收藏  举报