我有这个类对静态方法进行内部调用:
export class GeneralHelper extends BaseHelper{
static is(env){
return config.get('env:name') === env;
}
static isProd(){
return GeneralHelper.is('prod');
}
}
Run Code Online (Sandbox Code Playgroud)
我可以使用任何关键字来替换下面一行中的类名:
GeneralHelper.is('prod');
Run Code Online (Sandbox Code Playgroud)
在PHP中也有self,static等ES6是否提供类似这些东西吗?
TY.
ECMAScript 2015规范提到关键字(或单词?)new.target正好3次 - 在14.2.3中 1次:
通常,Contains不会查看大多数函数表单但是,Contains用于检测ArrowFunction中的new.target,this和super用法.
在14.2.16中两次:
ArrowFunction不为arguments,super,this或new.target定义本地绑定.对ArrowFunction中的参数,super,this或new.target的任何引用 都必须解析为词汇封闭环境中的绑定
MDN提到它,但非常模糊,页面不完整.
巴别塔似乎不支持它.尝试在函数(箭头或其他)中使用new.target时出现语法错误.
它是什么,它应该如何使用?