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?
for
loop: jsfiddle.net/jfriend00/ws705w5c \$\endgroup\$