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]); };