Converting an array into an object
Could you do it this way which would mean you're only traversing the array once?

var obj = {};

for (var i=0; i &lt; arr.length - 1; i = i + 2) {
    obj[arr[i]] = arr[i+1];
}