Reserved Terms

JavaScript contains a lot of core functionality. If the names of your custom JavaScript match up with anything built into the language, it can cause collisions and throw errors. You want to make sure all the function and variable names are as unique as possible to prevent problems and confusion while parsing the information. If you have two functions with the same name, it’s difficult to tell the browser which one to use, so it’s just not allowed.

To prevent these issues with native JavaScript, there are some reserved words (keywords) that you can’t use when defining variables, functions, methods, or identifiers within your code.

Following is a list of the reserved words:

  • break
  • case
  • catch
  • continue
  • debugger
  • default
  • delete
  • do
  • else
  • finally
  • for
  • function
  • if
  • implements
  • in
  • instanceof
  • interface
  • new
  • package
  • private
  • protected
  • public
  • return
  • static
  • switch
  • this
  • throw
  • try
  • typeof
  • var
  • void
  • while
  • with

If you use any of these terms in your code, the console will throw an error and let you know that you’re using a reserved word.

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +