Variable Name Expansion

Identifiers are expanded to their string value if the identifier is the name of a defined variable; otherwise, they are used literally. They are also used literally if they are surrounded by double quotes. For example:

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

..or..

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

 

To avoid unintentionally using the name of variable as its value, you should get into the habit of declaring your variables with the var statement.