Im doing one of my first real backend projects and i have a list of locations that looks like this: Country(array) -> state (array) -> location(array) -> names (array)
What i want to do is take a given name, and then walk back up the tree and get its parent location/state/country.
For example the big apple (name) -> new york (location) -> state (new york) -> country (usa)
Does anyone have any advice on how to do this without multiple loops?
I was thinking i could combine all locations and loop through, find a match then keep going up doing the same thing?
via rhysclay
No comments:
Post a Comment