typescript for loop use key to access values code example
Example 1: typescript for loop key value pai
for (let key in myDictionary) {
let value = myDictionary[key];
// Use `key` and `value`
}
Example 2: typescript key value loop
//< ES 2017:
Object.keys(obj).forEach(key => {
let value = obj[key];
});
//>= ES 2017:
Object.entries(obj).forEach(
([key, value]) => console.log(key, value);
);