Various words and symbols are reserved by JavaScript. These words cannot be used as variable names, nor can the symbols be used within them. They are listed in the following table.
abstract |
Boolean |
break |
byte |
Case |
catch |
char |
Class |
const |
continue |
Debugger |
default |
delete |
Do |
double |
else |
Enum |
export |
extends |
False |
final |
finally |
Float |
for |
function |
Goto |
if |
implements |
Import |
in |
instanceof |
Int |
interface |
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 | |
- |
! |
~ |
% |
/ |
* |
> |
< |
= |
& |
^ |
| |
+ |
? |
It is best to avoid the use of the following identifiers as variable names.
abs acos anchor asin atan atan2 big blink bold ceil charAt comment cos Date E escape eval exp fixed floor fontcolor fontsize getDate getDay getHours getMinutes getMonth getSeconds getTime getTimezoneOffset getYear indexOf isNaN italics lastIndexOf link log LOG10E LOG2E LN10 LN2 Math max min Object parse parseFloat parseInt PI pow random round setDate setHours setMinutes setMonth setSeconds setTime setYear sin slice small sqrt SQRT1_2 SQRT2 strike String sub substr substring sup tan toGMTString toLocaleString toLowerCase toUpperCase unescape UTC
caller className constructor java JavaArray JavaClass JavaObject JavaPackage join length MAX_VALUE MIN_VALUE NaN NEGATIVE_INFINITY netscape Number POSITIVE_INFINITY prototype reverse sort split sun toString valueOf
arity callee charCodeAt compile concat exec fromCharCode global ignoreCase index input label lastIndex lastMatch lastParen leftContext match multiline Number Packages pop push RegExp replace rightContext search shift slice splice source String test unshift unwatch watch
apply call getFullYear getMilliseconds getUTCDate getUTCDay getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds Infinity isFinite NaN setFullYear setMilliseconds setUTCDate setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds toSource toUTCString undefined