Function to convert an Array to an Associative array

JavaScript
var obj = {};
for (var i = 0, length = a.length; i < length; i += 2) {
  obj[a[i]] = a[i+1];
}

Source

Also in JavaScript: