Variable Values

If an identifier is the name of a defined variable, then it yields the variable value. Otherwise, the identifier name is used as a literal string. For example:

s = abc  // same as s = "abc" if abc is not defined


abc = Hello

s = abc     // same as s = "Hello" (if Hello is not defined!)

s = "abc"   // s equals "abc"


If the strictvars mode is enabled, then identifiers must be the names of defined variables, and the identi­fier name will never be used as a literal string.

To avoid unintentionally using the name of variable as a literal value, you should get into the habit of declar­ing your variables with the var statement. Or, you can use the strictvars statement to require variable declarations. See: strictvars Mode.