My array has mixed values. Some are strings and some are numbers. My array is
['Yoghurt', 48, 'Rice', 138, 'Apple', 52]
And I want my output:
{ Yoghurt: 48, Rice: 138, Apple: 52 }
Where every odd index is the property and every even index is the key. I've noticed that using Object.fromEntries will not work because my error is 'Yoghurt' is not an entry object.