TypeScript,遍历字典 - TypeScript, Looping through a dictionary

问题:

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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章