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 |
print |
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 |
原文网址:http://www.qianduanzu.com/2012033020.html
分享到:
相关推荐
Javascript的关键字及保留字不能用作函数名及变量名等
JavaScript关键字保留字属性及说明 适合初学者 对JavaScript有一定的基础知识
在 JavaScript 中,一些标识符是保留关键字,不能用作变量名或函数名。 JavaScript 标准 所有的现代浏览器完全支持 ECMAScript 3(ES3,JavaScript 的第三版,从 1999 年开始)。 ECMAScript 4(ES4)未通过。 ...
Javascript 的保留关键字(标识符)不可以用作变量、标签或者函数名。有些保留关键字是作为 Javascript 以后扩展使用。 abstract arguments boolean break byte case catch char class* const continue ...
javascript,VBScript关键字and保留字
程序开发中,经常需要自定义一些符号来标记一些名称,并赋予其特定的用途,如变量名、函数名等,这些符号都被称为标识符。 2.3.1 标识符 2、定义规则 由大小写字母、数字、下划线和美元符号($)组成。 不能以数字...
javascript常用关键字。有100多个。不是太全。
无数据库 纯javaScript实现关键字(中英文)搜索
JavaScript关键字保留字属性及说明.docx
JavaScript关键字保留字属性及说明.doc
javascript网页关键字高亮代码.docx
通俗:变量是用于存放数据的容器,我们通过变量名来获取数据,甚至数据可以修改。 2.2.2 变量的定义方式 2、变量的定义方式 语法:var 变量名 = 值 var是一个js关键字,用来声明变量。使用该关键字声明变量后,...
使用Javascript关键字作为变量名或函数名,会使Javascript在载入过程中出现编译错误。 Javascript关键字列表: break delete function return typeof case do if switch var catch else in this void ...
javascript 中 的关键字的保留字
整理了JavaScript的关键字与保留字
Python还被语言流行指数的编译器Tiobe将它被评为最受欢迎的编程语言,20多年来首次将Python置于Java、C和JavaScript之上,真的非常荣幸了. 自从20世纪90年代初Python语言诞生至2022年,它已被逐渐广泛应用于系统...
javascript正则匹配页面关键字,内附详细代码
自己写的一个简单的js关键字着色程序。只有100来 行,很简单只要熟悉正则都能看懂。放在这一来为了 备份,二来为了和大家交流。后期会写一个js格式化 的程序,将来会将这段代码整合的里面