[英]Objects within an Array, to be referenced later
我想將所有hmAttKeys放在一種hmFeeTypeAttKey類型下,以便以后我引用hmAttKeys時,它會單獨出現,但是我不確定正確的語法。 我還嘗試了hmFeeTypeAttKey[0] = [13,3,11,12]
。 有什么建議么?
hmAttKeys=[]
hmAttKeys[13]="/red";
hmAttKeys[3]="/blue";
hmAttKeys[11]="/green";
hmAttKeys[12]="/yellow";
var hmFeeTypeAttKey = [];
hmFeeTypeAttKey[0] = [13][3][11][12];
hmAttKeys[hmFeeTypeIndex[0]]
hmAttKeys=[]
hmAttKeys[13]="/red";
hmAttKeys[3]="/blue";
hmAttKeys[11]="/green";
hmAttKeys[12]="/yellow";
i=0;
var hmFeeTypeAttKey = [];
for( key in hmAttKeys )
{
hmFeeTypeAttKey[i]=key;
i++;
}
現在您可以遍歷數組以獲取鍵以供參考。
for(var j=0;j<hmfeeTypeAttKey.length;j++)
{
console.log(hmAttKeys[hmfeeTypeAttKey[j]])
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.