JavaScript|保留关键字

1.JavaScript保留关键字

Javascript 的保留关键字不可以用作变量、标签或者函数名。有些保留关键字是作为 Javascript 以后扩展使用:

abstract

arguments

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

2.JavaScript对象、属性和方法

避免使用 JavaScript 内置的对象、属性和方法的名称作为 Javascript 的变量或函数名:

Array

Date

eval

function

hasOwnProperty

Infinity

isFinite

isNaN

isPrototypeOf

length

Math

NaN

name

Number

Object

prototype

String

toString

undefined

valueOf

3.Java保留关键字

JavaScript 经常与 Java 一起使用,避免使用一些 Java 对象和属性作为 JavaScript 标识符。

4.Windows保留关键字

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

5.HTML事件句柄

避免使用 HTML 事件句柄的名称作为 Javascript 的变量及函数名。

onblur

onclick

onerror

onfocus

onkeydown

onkeypress

onkeyup

onmouseover

onload

onmouseup

onmousedown

onsubmit