So I have been programming for a while, and have many times stumbled upon a chance to use randomly generated variable names which could be used later on. I was wondering if this sort of thing was possible with plain javascript without libraries and arrays, and how I would go about doing so.
An example of what I am thinking (To better show what I am trying to ask) -->
function makeVariables(max) {
while(max < 10) {
var c(max) = "test";
max++;
}
}
Now say it produced 10 variables named: c0, c1, c2, c3, c4, c5, c6, c7, c8, c9.
And then be able to call it later like...
alert(c4);
Even though I know these few lines of code don't work, I would like (If it is possible) an example of how I could get it to work.
EDIT
I have no problem with arrays, I was simply wondering if it was possible. I wish to make different variables that can be reached, but my question has been answered. So thanks for all you helpers!