Convert an array to an array of objects

DEMO Using your supplied data: var data = [ [“fruits”,”frozen”,”fresh”,”rotten”], [“apples”,884,494,494], [“oranges”,4848,494,4949], [“kiwi”,848,33,33] ] The following function will treat the first element of the array as the keys for the objects properties. It will then loop over the remaining elements, and convert them into an object using these keys. Finally, it will return an array … Read more