How can you merge two arrays into key/value pairs please?
From this...
array1 = ['test1', 'test2'];
array2 = ['1', '2'];
To this...
array3 = ['test1':'1', 'test2':'2'];
If you are using underscore.js http://documentcloud.github.com/underscore/#zip you can simply do:
var zipped = _.zip(array1,array2);
_(zipped).map(function(v){ return v[0] + ":" + v[1] });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With