问题:
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