foreach over object keys code example
Example 1: loop an object properties in ts
Object.keys(obj).forEach(e => console.log(`key=${e} value=${obj[e]}`));
Example 2: object foreach
const obj = {
name: 'Jean-Luc Picard',
rank: 'Captain'
};
// Prints "name Jean-Luc Picard" followed by "rank Captain"
Object.keys(obj).forEach(key => {
console.log(key, obj[key]);
});