setInterval with an array

I would like to have a setInterval to be change able… for instance

somone clicked a button… i set an interval to do something along the lines of…

move the button over 1 px until it hits a specific area,

But I want to be able to use the same function… what I normally do for using variables with different names, is arrays… like

button[“picture_1”]
button[“picture_2”]

… as far as I know THE only way to add variables into the NAMe of a variable, is to use arrays…

like…

button[“picture_”+clicked]…

So I want to set an interval the same way…

myinterval[“anum_”+numberhere] = setInterval…

however it ONLY seems to work without using arrays…


Either I need to know how to name variables based on other variables,

or how to get setInterval to be saved as an array, without speeding up each time it’s called…