Is there a simple way in javascript to take a flat array and convert into an object with the even-indexed members of the array as properties and odd-indexed members as corre
var arr = [ 'a', 'b', 'c', 'd', 'e', 'f' ]; var obj = arr.reduce( function( ret, value, i, values ) { if( i % 2 === 0 ) ret[ value ] = values[ i + 1 ]; return ret; }, { } );