I have a very large hard coded index array that I would like to easily convert to an associative array so lookups are much quicker.
var arr = ["a", "b", "c"];
right now I am looping through arr and comparing it's values to a value to see if there is a match. Now that I have hundreds of elements it's getting rather slow and it would be faster to have an associative array.
It seems I can't just do
var arr = {"a", "b", "c"};
I can't really add a value since it is too slow.
Sure I could copy the elements to an associate array or sort the array and do a binary search but it would be much easier to just able to assign a default value to the array elements and use the syntax above.
I guess this is not possible though?