So I have an array of objects similar to below:
var objs = [
{ key: 'address', value: '1234 street' },
{ key: 'nameAndTitle', value: 'John Smith, CEO' },
{ key: 'contactEmail', value: '[email protected]' },
{ key: 'contactPhone', value: '1234567890' },
{ key: 'localPhone', value: '1234567890' },
{ key: 'status', value: 'open' },
]
And I would like it to be in the same order as another array of strings that I have that looks something like this.
var keys = [
'nameAndTitle',
'contactPhone',
'contactEmail',
'address',
]
I would like to order the objs array to match the order of the keys array. If the object doesn't exist in the keys array it should be placed at the bottom. Can anyone help me out with this?