Skip to content

Variable Name

IsaacShelton edited this page Mar 21, 2022 · 1 revision

Variable Name

Variables names are used to refer to a variable.

Valid variable names match the regular expression /[a-zA-Z_\\:][a-zA-Z0-9_\\:]*/.

Examples

Plain variables

my_variable
_unused_var
value1234

"Namespaced" variables (very uncommon)

audio\context
window\context
svg\render\logger
audio:context
window:context
svg:render:logger

Namespaces

Variables that are "namespaced" with either \ or : are treated the same, since : is an accessibility syntax for \. So the following two examples are equivalent:

parse\ctx
parse:ctx

Underscore Prefixed

Variables names that are prefixed with an underscore don't generate warnings about being unused.

_my_unused_variable
Clone this wiki locally