I have a JSON file that I wish to sort by a certain field.
I have found the code I am using works fine for sorting strings but when passed a key that is a integer or array an error message is thrown.
I have created a very small version as an example, this can be found in this JSFiddle; [(https://jsfiddle.net/a4poster/54hjyrnt/)]
For example on line 37 -
search_venueDB = approach2Fn(venueDB, "country");
If I change this to:
_search_venueDB = approach2Fn(venueDB, "active");
or
search_venueDB = approach2Fn(venueDB, active);_
an error message is thrown.
I know for the JSON in this example I could use a simple for loop but the actual JSON file is a lot larger.
I am a relative newbie to Javascript, so please be lenient with me. Is their is a better way then I am open to ideas.
Top comments (0)