I have cascading filter dropdown, country dropdown and state dropdown. Once the selections are made, I need to redirect the user to the respective page. E.g.
{
USA + Texas : Texas URL,
Germany + Berlin: Berlin URL
}
I can do this, but this makes no sense. I need the selected values pair to be the key.
{
Texas URL: ["USA", "Texas"],
Berlin URL: ["German", "Berlin"]
}
I need to create a data structure kind of like an Object map or hash table to capture this data.
Can someone give me suggestions on how best to create this data structure. Here is the my code so far:
let country="USA", region="Texas"; let myKey = country + "-" + region;and separate them again later by finding the "-" character. ... It seems like using a more complex structure would just change the work of separating them later into different work of reintegrating them later (from different parts of the structure), but if you definitely prefer that, I can write an actual answer to address it.