Combine two arrays in JavaScript

javascript, jquery

Solution

var arr3 = {};
for (var i = 0; i < arr1.length; i++) {
    arr3[arr1[i]] = arr2[i];
}

Please note that `arr3` is not array, it is object.

Problem

Can I merge two arrays in JavaScript like this? these arrays: ``` arr1 = ['one','two','three']; arr2 = [1,2,3]; ``` into ``` arr3 = ['one': 1, 'two': 2, 'three' : 3] ```

Original source