Is it possible to sort and rearrange an array that looks like this:
itemsArray = [ [\'Anne\', \'a\'], [\'Bob\', \'b\'], [\'Henry\', \'b\'],
ES6
const arrayMap = itemsArray.reduce( (accumulator, currentValue) => ({ ...accumulator, [currentValue[1]]: currentValue, }), {} ); const result = sortingArr.map(key => arrayMap[key]);
More examples with different input arrays