本文介绍了javascript:为什么缺少名字后。出现操作员警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么在我的剧本中写为什么缺少姓名之后。运算符当我包含这样的脚本时
why in my script written why missing name after . operator when I've included a script like this
this.switch = function(){ if (this.status == "enabled") { this.disable(); this.stop(); } else { this.enable(); } }该脚本旨在将状态从启用转移到禁用
the script is meant to divert status from enabled to disabled
推荐答案switch 是一个保留关键字(适用于... 切换语句!)。如果你强制要求,绝对必须使用这个名称,写一下这个['switch'] ,但是使用它会很烦人。
switch is a reserved keyword (for ... switch statements!). If you imperatively, absolutely must use this name, write this['switch'] instead, but it will be annoying to use.
打开/关闭某个功能的常用名称是 toggle()。
A common name for a function that turns something on/off is toggle().
更多推荐
javascript:为什么缺少名字后。出现操作员警报
发布评论