問題:
In my code, I have a couple of dictionaries (as suggested here ) which is String indexed.在我的代碼中,我有幾個字典(如這裏建議的那樣),它們是字符串索引的。 Due to this being a bit of an improvised type, I was wondering if there any suggestions on how I would be able to loop through each key (or value, all I need the keys for anyway).由於這是一種即興的類型,我想知道是否有任何關於如何循環遍歷每個鍵(或值,無論如何我都需要這些鍵)的建議。 Any help appreciated!任何幫助表示讚賞!
myDictionary: { [index: string]: any; } = {};
解決方案:
參考一: https://stackoom.com/question/15rdu參考二: TypeScript, Looping through a dictionary