JavaScript Keywords

In JavaScript, a keyword is a reserved word define by the JavaScript developer, with its pre-defined meaning. For example:

HTML with JavaScript Code
<!DOCTYPE html>
<html>
<body>

   <p id="xyz"></p>
   
   <script>
      var x = 10;
      if(x == 0) {
         document.getElementById("xyz").innerHTML = "The value of 'x' is equal to 0.";
      }
      else if(x > 0) {
         document.getElementById("xyz").innerHTML = "The value of 'x' is a positive number.";
      }
      else {
         document.getElementById("xyz").innerHTML = "The value of 'x' is a negative number.";
      }
   </script>
   
</body>
</html>
Output

In above example, the var, if, and else are keywords. The var is used to declare a variable. The if is used when we need to execute some block of code, when the specified condition evaluates to be true. The else is the counter-part of if.

Note - Do not use any keyword as an identifier. If you do so, then that word acts the way, it is defined by the developer. So avoid using any keyword listed in this article.

List of All Keywords in JavaScript

Here are the list of all keywords available in JavaScript:

  • alert
  • anchor
  • anchors
  • area
  • arguments
  • array
  • assign
  • await
  • blur
  • break
  • button
  • case
  • catch
  • checkbox
  • class
  • clearinterval
  • cleartimeout
  • clientinformation
  • close
  • closed
  • confirm
  • const
  • constructor
  • continue
  • crypto
  • date
  • debugger
  • decodeuri
  • decodeuricomponent
  • default
  • defaultstatus
  • delete
  • do
  • document
  • element
  • elements
  • else
  • embed
  • embeds
  • encodeuri
  • encodeuricomponent
  • enum
  • escape
  • eval
  • eval
  • event
  • export
  • extends
  • false
  • fileupload
  • finally
  • focus
  • for
  • form
  • forms
  • frame
  • framerate
  • frames
  • function
  • function
  • getclass
  • hasownproperty
  • hidden
  • history
  • if
  • image
  • images
  • implements
  • import
  • in
  • infinity
  • innerheight
  • innerwidth
  • instanceof
  • interface
  • isfinite
  • isnan
  • isprototypeof
  • java
  • javaarray
  • javaclass
  • javaobject
  • javapackage
  • layer
  • layers
  • length
  • let
  • link
  • location
  • math
  • mimetypes
  • name
  • nan
  • navigate
  • navigator
  • new
  • null
  • number
  • object
  • offscreenbuffering
  • onblur
  • onclick
  • onerror
  • onfocus
  • onkeydown
  • onkeypress
  • onkeyup
  • onmouseover
  • onload
  • onmouseup
  • onmousedown
  • onsubmit
  • open
  • opener
  • option
  • outerheight
  • outerwidth
  • package
  • packages
  • pagexoffset
  • pageyoffset
  • parent
  • parsefloat
  • parseint
  • password
  • pkcs11
  • plugin
  • private
  • prompt
  • propertyisenum
  • protected
  • prototype
  • public
  • radio
  • reset
  • return
  • screenx
  • screeny
  • scroll
  • secure
  • select
  • self
  • setinterval
  • settimeout
  • static
  • status
  • string
  • submit
  • super
  • switch
  • taint
  • text
  • textarea
  • this
  • throw
  • top
  • tostring
  • true
  • try
  • typeof
  • undefined
  • unescape
  • untaint
  • valueof
  • var
  • void
  • while
  • window
  • with
  • yield

JavaScript Online Test


« Previous Tutorial Next Tutorial »



Like/Share Us on Facebook 😋