In python, I can use tuples as a dictionary key. What is equivalent in javascript?
>>> d = {}
>>> d[(1,2)] = 5
>>> d[(2,1)] = 6
>>> d
{(1, 2): 5, (2, 1): 6}
For those who are interested, I have two arrays ...
positions = ...
normals = ...
I need to make a third array of positions / normal pairs, but don't want to have duplicate pairs. My associative array will allow me to check if I have an existing pair [(posIdx,normalIdx)]for reuse or creation, if I do not.
I need some way to index using a two-digit key. I could just use a string, but that seems a little slower than two numbers.
source
share