Being new to typescript, I am unsure how to map values inside a loop. I have a function that performs some logic and returns a number. This function will be called in another function to return two values: a number and a string.
export class matrix {
public pattern!: {[key: string]: number[]};
// The function will be called within a loop in another function
public setPattern(data: number, category: string): void {
// Logic is implemented here to set row as a value
const row = 10; // just a random value
this.pattern[category].push(row); // not functional at the moment
}
}
// Expected output structure
{
"some category": [10,55,4,53,1],
"more rows": [1,2,8]
}