I’ve got 2 arrays:
const array_1 = ["a", "b", "c"]
const array_2 = [["c", {animal: "dog"}], ["e", {animal: "cat"}], ["b", {animal: "mouse"}],["d", {animal: "frog"}], ["a", {animal: "cow"}]]
Now I want to have this output
const array_final = [["a", {animal: "cow"}], ["b", {animal: "mouse"}], ["c", {animal: "dog"}], ["e", {animal: "cat"}], ["d", {animal: "frog"}] ]
So what shall I do in order to sort array of arrays with the array_1 (only with the entries that occurs in both, entries with “e” or “d” might be in any order)