Converts an array to an object in javascript. Flips the array, so values are the keys, as well as