Just because you said in jQuery , here is the jQuery $.each .
arr1 = ['one','two','three']; arr2 = [1,2,3]; arr3 = {}; $.each(arr1, function(i, value){ arr3[value] = arr2[i]; }); console.log(JSON.stringify(arr3));
conclusion →
{"one":1,"two":2,"three":3}
here is working jsFiddle
Ohgodwhy
source share