快速問題 我有一個散列表,每個鍵都有一個對象,它分爲兩部分:主題和查詢。 我試圖獲取查詢和主題的值,但我不能。我所得到的都是未定義的。 我如何獲得價值?在javascript中獲取散列表中的信息
function IntersectGroups(keyToGeneDetailMappingGroupArray) {
allKeys = CreateSetWithAllKeys(keyToGeneDetailMappingGroupArray);
var numElements = Math.pow(2, keyToGeneDetailMappingGroupArray.length);
var results1= new Array(numElements);
for (var j = 0; j < results.length; j++)
{
results1[j] = 0;
}
// Run for every key (for all groups)
for (var currentKey in allKeys.items)
{
var linescontent="";
var index = 0;
// Run for every group
for (var k = 0; k < keyToGeneDetailMappingGroupArray.length; k++)
{
var isGroupContained = keyToGeneDetailMappingGroupArray[k].hasItem(currentKey);
if (isGroupContained)
{
//Not relevent: Watch the data structures: sumElements += keyToGeneDetailMappingGroupArray[k].getItem(currentKey).length;
sumElements += 1;
linescontent += currentKey.Query;//I get undefined
index += Math.pow(2, k);
}
}
results1[index] += linescontent;
}
return results1;
}
數據例如
Query Subject
Crella_elegansContig_3 tr|Q8BUQ6|Q8BUQ6_MOUSE
Crella_elegansContig_10 sp|Q8CHY3-2|DYM_MOUSE
Crella_elegansContig_14 sp|Q9R1L5|MAST1_MOUSE
Crella_elegansContig_16 sp|Q8BGZ4-2|CDC23_MOUSE
Crella_elegansContig_26 sp|Q9CPS6|HINT3_MOUSE
Crella_elegansContig_29 sp|Q8BP67|RL24_MOUSE
Crella_elegansContig_31 sp|A3FIN4-2|AT8B5_MOUSE
Crella_elegansContig_32 tr|E9PZX7|E9PZX7_MOUSE
Crella_elegansContig_33 sp|Q6P7W0|SENP6_MOUSE
請添加數據和函數頭以及函數的調用。 –
請看看這裏:[mcve] –