If I have an array that looks like below:
[{"matchedKey":"cuisineType","cuisineType":"Indian","group":"group"},
{"matchedKey":"cuisineType","cuisineType":"Italian","group":"group"},
{"matchedKey":"cuisineType","cuisineType":"Asian","group":"group"},
{"matchedKey":"cuisineType","cuisineType":"Japanese","group":"group"},
{"matchedKey":"cuisineType","cuisineType":"African","group":"group"}]
How can I sort this by cuisineType?
I have tried to use:
var result = array.find(obj => {
var go = obj.cuisineType
console.log(String(obj.cuisineType))
})
However I cannot figure out how to:
Put it in a single string with command separating the results (they just print to the console individually).
use the string I just made as
console.log(go)
orconsole.log(result)
prints 'undefined'.
Thanks for your help in advance! I've tried other suggestions on SO and beyond but haven't had much success!