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
Pretty sure this will work and is shorter:
var arr = [ 'a', 'b', 'c', 'd', 'e', 'f' ]; var obj = {}; while (arr.length) { obj[arr.shift()] = arr.shift(); }
See shift().