I'm struggling with what seems like a simple question, but I can't seem to find an easy solution.
When working in Typescript, I need to manipulate each object within an array and return the modified array.
Here's an example:
foo = [{code: 1, desc:"a"},
{code: 2, desc:"b"},
{code: 3, desc:"c"}];
get Foo() {
return this.foo.forEach((item) => {
return {code:item.code + 1, desc: item.desc};
});
}
However, this getter is returning undefined.
Can someone guide me on the correct approach to achieving my desired outcome?