I have the following array
let requiredFields = ["Given Name", "Surname", "Sex", "Birth Date", "Birth Place"]
I am filtering an input array to only return objects where the x.key value is equal to one of the required values.
let filtered = fields.filter((x) => requiredFields.includes(x.key));
Now how do i sort this filtered array so the objects are in order of the requiredFields array.
x.key refers to a value found in requiredFields.