var arr = [ key1, value1 , key2, value2 ]
var arr = { key1: value1 , key2: value2 }
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);
var arr = [ 0, 1 , 2, 3 ]; var obj ={}; for(var i = 0; i<arr.length; i++){ obj[arr[i]] = arr[++i]; }; for( i in obj){ alert(i+' = '+obj[i]); };
var arr = [ 0, 1 , 2, 3 ], obj ={}; for(var i = 0; i<arr.length; i++){ if(arr[i]%2 == 1) obj[arr[i]-1] = arr[i]; }; for( i in obj){ alert('Key' + i+' => ' + obj[i]); };