Accepted answer

if chart1 is a global variable, you can do:


because global variables are automatically turned into properties of the window object.

if it's not a global variable, you can't do this. it would be best to make chart an array, rather than having chart1, chart2, etc. then you could do:


Related Query

More Query from same tag