Please forgive me, but I do know js basics and how to write/call a basic function, but in this case I'm trying to match an alpha sorted list of categories from the DB to match against my set (non-alpha) order of said categories as specified below (this is code suggested for use by another user on a question I asked about how to map the order of categories being returned). However, I can't figure out how to integrate that person's code answer into my own code.
Just seeing it implemented against another example list (to mimic what I would grab from the DB) and how I would call it in a switch case statement to wrap my html around the category names and return them to the web page in the mapped order I want would help a great deal. Sorry if it turns out to be obvious. I'm trying to learn what I can as I encounter these problems. Thanks!
var categories = [ 'F', 'C', 'A1', 'A2', 'A3' ].map(function (category) {
return businesses.filter(function (business) {
return business.category === category;
});
});