1. 标识符:在JS中所有的可以有我们自主命名的都可以称为是标识符。
例如:变量名、函数名、属性名都属于标识符。
2. JavaScript语言中标识符的命名规则:
① 区分大小写,Myname与myname是两个不同的标识符。
② 标识符首字符可以是以下划线(_)、美元符($)或者字母开始,不能是数字。
③标识符中其它字符可以是下划线(_)、美元符($)、字母或数字组成的。
例: userName,User_Name,_sys_val,身高,$change等均为合法的标识符,而2mail,room#,class为非法的标识符。其中,使用中文“身高”命名的变量是合法的。
注意:JavaScript中的字母是采用Unicode,Unicode叫做统一编码制,是国际上通用的16位编码制,它包含了亚洲文字编码,如中文、日文、韩文等字符。所有JavaScript中的字母可以是中文、日文和韩文等亚洲字母。
4. 保留字:保留字是语言中定义具有特殊含义的标识符,保留字不能作为标识符使用。JavaScript语言中定义了一些具有专门的意义和用途的保留字,这些保留字称为关键字。
在 JavaScript 中,您不能把这些保留词作为变量、标记或函数名来使用:
|
abstract |
arguments |
await* |
boolean |
|
break |
byte |
case |
catch |
|
char |
class* |
const |
continue |
|
debugger |
default |
delete |
do |
|
double |
else |
enum* |
eval |
|
export* |
extends* |
false |
final |
|
finally |
float |
for |
function |
|
goto |
if |
implements |
import* |
|
in |
instanceof |
int |
interface |
|
let* |
long |
native |
new |
|
null |
package |
private |
protected |
|
public |
return |
short |
static |
|
super* |
switch |
synchronized |
this |
|
throw |
throws |
transient |
true |
|
try |
typeof |
var |
void |
|
volatile |
while |
with |
yield |
|
abstract |
boolean |
byte |
char |
|
double |
final |
float |
goto |
|
int |
long |
native |
short |
|
synchronized |
throws |
transient |
volatile |
11. JavaScript 对象、属性和方法
|
Array |
Date |
eval |
function |
|
hasOwnProperty |
Infinity |
isFinite |
isNaN |
|
isPrototypeOf |
length |
Math |
NaN |
|
name |
Number |
Object |
prototype |
|
String |
toString |
undefined |
valueOf |
13. Java 保留词
|
getClass |
java |
JavaArray |
javaClass |
|
JavaObject |
JavaPackage |
15. 其他保留词
|
alert |
all |
anchor |
anchors |
|
area |
assign |
blur |
button |
|
checkbox |
clearInterval |
clearTimeout |
clientInformation |
|
close |
closed |
confirm |
constructor |
|
crypto |
decodeURI |
decodeURIComponent |
defaultStatus |
|
document |
element |
elements |
embed |
|
embeds |
encodeURI |
encodeURIComponent |
escape |
|
event |
fileUpload |
focus |
form |
|
forms |
frame |
innerHeight |
innerWidth |
|
layer |
layers |
link |
location |
|
mimeTypes |
navigate |
navigator |
frames |
|
frameRate |
hidden |
history |
image |
|
images |
offscreenBuffering |
open |
opener |
|
option |
outerHeight |
outerWidth |
packages |
|
pageXOffset |
pageYOffset |
parent |
parseFloat |
|
parseInt |
password |
pkcs11 |
plugin |
|
prompt |
propertyIsEnum |
radio |
reset |
|
screenX |
screenY |
scroll |
secure |
|
select |
self |
setInterval |
setTimeout |
|
status |
submit |
taint |
text |
|
textarea |
top |
unescape |
untaint |
|
window |
18. HTML 事件处理程序
|
onblur |
onclick |
onerror |
onfocus |
|
onkeydown |
onkeypress |
onkeyup |
onmouseover |
|
onload |
onmouseup |
onmousedown |
onsubmit |
原文:https://www.cnblogs.com/fei-yu9999/p/14965992.html