List of Keywords and reverved words in Javascript

By: Emiley J. Printer Friendly Format    

Keywords

By rule, keywords are reserved and cannot be used as variable or function names. Here is the complete list of JavaScript keywords:

break
case
catch
continue 
default 
delete 
do 
else
finally 
for 
function 
if 
in 
instanceof 
new
return
switch
this
throw
try
typeof
var
void
while
with

If you use a keyword as a variable or function name, you will probably be greeted with an error message like this: “Identifier expected.”

Reserved Words

JavaScript also defines a number of reserved words. The reserved words are, in a sense, words that are reserved for future use as keywords. Because of this, reserved words cannot be used as variable or function names. The complete list of reserved words in ECMA-262 Edition 3 is as follows:

abstract
boolean
byte 
char 
class 
const 
debugger 
double 
enum
export 
extends 
final 
float 
goto 
int
interface
implements
import
long
native
package
private
protected
public
short
static
super
synchronized
throws
transient
volatile

If you use a reserved word as a variable or function name, more than likely you will not receive an error...until a future browser implements one of them. Then the word will be considered a keyword, and you will get a keyword error.



Ask a Question



Most Viewed Articles (in Javascript )

Latest Articles (in Javascript)

Comment on this tutorial

Ask a Question

Subscribe to Tutorials

Related Tutorials

Archived Comments

1. My partner and I stumbled over here coming from a
View Tutorial          By: iphone 7 cases louis vuitton at 2016-10-31 13:36:05

2. It's actually a nice and helpful piece of info. I
View Tutorial          By: Alcobendas at 2017-03-23 15:19:22

3. Howdy jjust wanted to give you a quick heads up. T
View Tutorial          By: Runescape Money site at 2017-05-23 04:35:26

4. Hi i am kavin, its my first occasion to commenting
View Tutorial          By: twitter.com at 2017-06-07 16:23:04

5. Pr-do-sol na Areal do Arur: Certa burgo de pescado
View Tutorial          By: https://plus.google.com/ at 2017-07-15 06:37:19

6. Larryhaw
View Tutorial          By: Larryhaw at 2017-07-27 09:52:11

7. Destinado a iniciar este regio, a forma geral, sit
View Tutorial          By: veja a Rio Promo Tours at 2017-07-28 20:16:01

8. Larryhaw
View Tutorial          By: Larryhaw at 2017-07-29 16:29:31