JavaScript保留关键字及危险变量名
JavaScript保留关键字及危险变量名 定义变量名需谨慎
在开发过程当中,如果没有必要就尽可能少的使用以下列出的单词作为变量名称或者属性名称,关键字是严格不允许,而浏览器定义的变量名或者类名在使用的时候注意确保作用域
一、现在 EMCAScript 中的关键字:
break | case | catch | continue |
default | delete | do | else |
finally | for | function | if |
in | instanceof | new | return |
switch | this | throw | try |
typeof | var | void | while |
with |
二、将来EMCAScript 5中可能使用的关键字:
abstract | boolean | byte | char |
class | debugger | double | enum |
extends | final | float | goto |
implements | int | interface | long |
native | package | private | protected |
public | short | static | super |
synchronized | throws | transient | volatile |
三、 JavaScript2.0(future) 不明确提到的关键字:
as | const | export | import |
is | use |
四、绝大部分浏览器中预定义的一些变量名和类名:
Anchor | anchors | Applet | applets |
Area | Array | Body | Button |
Checkbox | Date | document | Error |
EvalError | FileUpload | Form | forms |
frame | frames | Function | Hidden |
History | history | Image | images |
Link | links | location | Math |
MimeType | mimetypes | navigator | Number |
Object | Option | options | Password |
Plugin | plugins | Radio | RangeError |
ReferenceError | RegExp | Reset | screen |
Script | Select | String | Style |
StyleSheet | Submit | SyntaxError | Text |
Textarea | TypeError | URIError | window |
五、全局属性及方法:
Infinity | NaN | undefined | decodeURI |
decodeURIComponent | encodeURI | encodeURIComponent | escape |
eval | isFinite | isNaN | parseFloat |
parseInt | unescape |
六、Window对象的属性和方法:
1、property:
closed | Components | content | controllers |
defaultStatus | directories | document | frames |
history | innerHeight | innerWidth | length |
location | locationbar | menubar | name |
navigator | opener | outerHeight | outerWidth |
pageXOffset | pageYOffset | parent | personalbar |
pkcs11 | prompter | screen | screenX |
screenY | scrollbars | scrollX | scrollY |
self | statusbar | toolbar | top |
window |
2、Methods:
alert | back | blur | captureevents |
clearInterval | clearTimeout | close | confirm |
dump | escape | focus | forward |
getAttention | getSelection | home | moveBy |
moveTo | open | prompt | |
releaseevents | resizeBy | resizeTo | scroll |
scrollBy | scrollByLines | scrollByPages | scrollTo |
setCursor | setInterval | setTimeout | sizeToContents |
stop | unescape | updateCommands |
七、事件:
onabort | onblur | onchange | onclick |
onclose | ondragdrop | onerror | onfocus |
onkeydown | onkeypress | onkeyup | onload |
onmousedown | onmousemove | onmouseout | onmouseover |
onmouseup | onpaint | onreset | onresize |
onscroll | onselect | onsubmit | onunload |
八、特定浏览器中预定义的变量名和类名:
all | assign | clientInformation | element |
embed | embeds | event | frameRate |
getClass | java | JavaArray | JavaClass |
JavaObject | JavaPackage | layer | layers |
netscape | offscreenBuffering | opener | packages |
secure | status | sun | taint |
toSource | toString | untaint | valueOf |
posted on 2012-03-30 15:07 前端组www.qianduanzu.com 阅读(338) 评论(0) 编辑 收藏 举报
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库