Write a function named arrayToObject that receives an array of strings as parameter and returns an object where each key is an item of the array and its value is the index of that item.
If there are duplicate strings in the array, the value inside the object should be the index of it's first occurrence.
strings
=strings
=Unlock all functions
The first 10 functions are free. Get lifetime access to all 100 with a one-time payment — no subscription.
Upgrade to Pro