I'm have trouble finding a way to push values into an array dynamically. I have given the following situation:
var get_anchors= new Array('pitzel','mitzel','sizzle')
current_anchor= pics[key].anchor; //has the value 'sizzle'
get_anchors[current_anchor].push(new Array('sizzle2','sizzle3'))
Javascript fails and says get_anchors[current_anchor] is undefined
How can I make get_anchors[current_anchor] work. Or is there a different way to get this done?
The desired result should look like 'pitzel','mitzel','sizzle'['sizzle2','sizzle3]
get_anchors[current_anchor]isundefined, sincecurrent_anchoris not0,1or2. What are you trying to accomplish? You will get better answers if you provide more information.pitzel,pitzelandsizzleare anchors andsizzleXare picture names? Seems like you want a hash map instead of an array...