How can I associate two arrays that contains keys and values into one array with key->value pairs?
In Mootools there is associate
function which does:
var animals = ['Cow', 'Pig', 'Dog', 'Cat'];
var sounds = ['Moo', 'Oink', 'Woof', 'Miao'];
sounds.associate(animals);
// returns {'Cow': 'Moo', 'Pig': 'Oink', 'Dog': 'Woof', 'Cat': 'Miao'}
Is there any similar function in JQuery to obtain the same result from those two arrays?
If not, how can I do it?
.associate()
method. – Doily