I possess an array
const arr = [
{label: 'a', width: 200},
{label: 'b', width: 200},
{label: 'c', width: 200},
{label: 'd', width: 200},
{label: 'e', width: 200}
];
provided with another array
const data = ['d', 'e', 'a', 'c', 'b'];
An arrangement is needed for the first array based on the new data.
Which javascript function should be used for this purpose?
Edit: Appreciating the insightful comments. To add complexity, let's consider that data might not necessarily encompass the entire initial array.
const data = ['a', 'c'];
The resultant array is expected to have 'a' and 'c' as the first two elements, followed by 'b', 'd', and 'e'. The final array should appear in the order of a, c, b, d, e.