I have a situation where I want to create a mapping from a tuple to an integer. In python, I would simply use a tuple (a,b) as the key to a dictionary,

Does Javascript have tuples? I found that (a,b) in javascript as an expression just returns b (the last item). Apparently this is inherited from C.

So, as a workaround, I thought I can use arrays instead,

my_map[[a,b]] = c

I tried it at the Firebug console and it seemed to work. Is that a good way to do it?

Another alternative I thought of is to create a string out of the tuples

my_map[""+a+":"+b] = c

So the question is: is there any problem with any of these methods? Is there a better way?

EDIT:

Small clarification: in my case, a,b,c are all integers

Edit
Report