首页 > 解决方案 > 访问对自己类中的类的引用

问题描述

在下面的代码中,如何访问变量而不在其自己的类User 中明确指定关键字“用户” ?

class User {
  say = () => {
    // Here, I have to explicitly write "User". Is there
    // some javascript trick to get the class reference inside 
    // its own class without explicitly writing the name?
    console.log(User);
  }
}

标签: javascriptnode.jsecmascript-6ecmascript-2016

解决方案


推荐阅读