This question already has an answer here:
Is there a common Javascript/Coffeescript-specific idiom I can use to accomplish this? Mainly out of curiosity.
I have two arrays, one consisting of the desired keys and the other one consisting of the desired values, and I want to merge this in to an object.
keys = ['one', 'two', 'three']
values = ['a', 'b', 'c']
As long as the two arrays are the same length, you can do this:
Explanation: In coffeescript you can iterate an array and get each item and its position on the array, or index. So you can then use this index to assign keys and values to a new object.