Converting an array into an object I have an array of this fashion:

var arr = ["akira",9248,"padilla",100];


I'm using filter to take the names and the points:

var names = arr.filter(function(e,i){return i%2 == 0});
var points = arr.filter(function(e,i){return i%2 !== 0});


Then I do this to obtain turn it into object:

console.log(JSON.stringify(_.object(names,points)));


What's best in terms of performance/JS quality?
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];
}