Rules for Creating Binding Names in JavaScript (EVERYONE Should Know!)

When you’re making binding names, you can make up almost anything.

You can even have digits inside a binding name like iamlegend23.

However, a few rules you must abide by when coming up with a binding name:

  • The binding name must not start with a digit.
  • The only symbol or special character you can include in a binding name is the dollar sign $ and the underscore _.
  • You cannot use keywords that are reserved for JavaScript as binding names.

What are the keywords reserved by JavaScript?

These are words that JavaScript has kept for themselves to be used for special functions or to activate something.

Don’t use them when coming up with a binding name or else you’ll cause some confusion between JavaScripts interpretation of it.

Some of these keywords are as follows:

  • break
  • case
  • catch
  • class
  • const
  • continue
  • debugger
  • default
  • delete
  • do
  • else
  • enum
  • export
  • extends
  • false
  • finally
  • for
  • function
  • if
  • implements
  • import
  • interface
  • in
  • instanceof
  • let
  • new
  • package
  • private
  • protected
  • public
  • return
  • static
  • super
  • switch
  • this
  • throw
  • true
  • try
  • typeof
  • var
  • void
  • while
  • with
  • yield

Leave a Comment