为什么在我的剧本中写下为什么缺少名字.当我包含这样的脚本时,运算符
this.switch = function(){
if (this.status == "enabled")
{
this.disable();
this.stop();
}
else
{
this.enable();
}
}
Run Code Online (Sandbox Code Playgroud)
该脚本旨在将状态从启用转移到禁用
Vic*_*let 16
switch是一个保留关键字(用于... switch语句!).如果你势在必行,绝对必须使用这个名字,this['switch']而不是写,但使用起来会很烦人.
打开/关闭某个功能的常用名称是toggle().