var obj ={}; for(let i = 0; i<arr.length; i++){ obj[arr[i]] = arr[++i]; }
var arr = [ key1, value1 , key2, value2 ]; var obj ={}; for(let i = 0; i<arr.length; i++){ obj[arr[i]] = arr[++i]; } console.log(obj);