Like every coding language, JavaScript has certain keywords reserved for its own use. Using any of these reserved words as identifiers or literals can cause odd behavior in a script, especially if the named entity is used with the original at the same time.
For example, the following script will not do what you think it should, and in fact will generate an error.
var = "This is a variable.";
document.write ( var )
Basically, reserved keywords are words already in use by the language, and names of built-in JavaScript objects, properties, methods, and functions.
If you use an editor that automatically formats JavaScript code, you do not need to memorize all the keywords as these are typically formatted in a different font or style.
If you need some guide, the following table lists the currently reserved keywords, and will no doubt be expanded as the language develops.
JavaScript Reserved Keywords |
abstract
boolean
break
byte
case
catch
char
class
const
continue
default
do
double
else |
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
var
void
while
with |