Using a non-object approach, to get exactly the solution you were looking for would be as follows (using eval() or a window object):
var values = [ "Budget1-green", "Team1-green", "Risk1-green", "Benefit1-green", "Scope1-green", "Schedule1-green" ];
Using a window object is the preferred method, as eval can potentially be dangerous.
Also, be careful when using dynamically created variables, as this can cause confusion if, for example, a variable named "Budget1" has already been specified in the global area.
source share