Bagikan melalui


JScript Reserved Words (Visual Studio - JScript)

JScript has a number of reserved words that have a specific meaning in the JScript language syntax. Consequently, these words are not good choices for names of functions, variables, or constants in scripts. There are three classes of reserved words.

Protected Reserved Words

Protected reserved keywords cannot be used as identifiers. Using a protected reserved word as an identifier causes a compilation error when loading your script.

break

case

catch

class

const

continue

debugger

default

delete

do

else

export

extends

false

finally

for

function

if

import

in

instanceof

new

null

protected

return

super

switch

this

throw

true

try

typeof

var

while

with

Note

Although "export" is a protected reserved word, it has no implementation.

New Reserved Words

JScript also has a list of new reserved words. Like protected reserved words, these keywords have special meaning within the current version of JScript. For backward compatibility reasons, new reserved words can be used as an identifiers. Once a new reserved word is used as an identifier, it loses its meaning as a keyword in the script. Using new reserved words as identifiers can cause confusion and should be avoided.

abstract

boolean

byte

char

decimal

double

enum

final

float

get

implements

int

interface

internal

long

package

private

protected

public

sbyte

set

short

static

uint

ulong

ushort

void

 

 

 

Future Reserved Words

JScript has a list of future reserved words, which are proposed as keywords in future extensions of JScript. Like the new reserved words, these may be used as identifiers in the current version of JScript. However, by avoiding these words, it will be easier to update scripts to take advantage of the features in upcoming versions of JScript.

When choosing identifiers it is also important to avoid words that are already the names of intrinsic JScript objects or functions, such as String or parseInt.

assert

ensure

event

goto

invariant

namespace

native

require

synchronized

throws

transient

use

volatile

 

 

See Also

Other Resources

JScript Reference

JScript Language Tour