Tallaght Campus

Department of Computing

Javascript Identifiers

Javascript identifiers are used for naming functions and variables. These must be defined in accordance with the following rules:

  1. must not be a Javascript reserved word (list)
  2. may contain letters, digits (0 to 9), dollar signs ($) and underscores (_)
  3. must start with a letter, a dollar sign ($) or an underscore (_)
  4. must be case-sensitively unique to its context (you cannot have two variables with the same name)

Valid:

  • _aVar
  • var123
  • my_function

Invalid:

  • var (breaks rule 1)
  • my#Function (breaks rule 2)
  • 1goodVar (breaks rule 3)