javascript:为什么缺少名字后。出现操作员警报

编程入门 行业动态 更新时间:2024-10-09 14:23:56
本文介绍了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:为什么缺少名字后。出现操作员警报

本文发布于:2023-11-28 00:00:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640142.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:操作员   警报   名字   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!