Lets say we have the following:
let x = [
{"color": "blue", "cat": "eec" },
{"color": "red", "cat": "vbs" },
{"color": "black", "cat": "asd" },
]
how can I sort this by cat? so that I can then do something like
let y = sorted.asd.color;
or
y = sorted[asd][color];
note: cat is unique
Thanks
.sortcan take a function