Encountered a puzzling issue that requires immediate clarification. When I input the following code into my project:
this.metadata = json.metadata.map((x) => {return new Metadatum(x);});
console.log(this.metadata[0].value);
The output consistently shows 'undefined' for every element in json.metadata.
However, when I switch gears and use the map function incorrectly (I acknowledge that using forEach would be more appropriate), like so:
json.metadata.map(x => this.metadata.push(new Metadatum(x)));
console.log(this.metadata[0].value);
Suddenly, the correct values are displayed instead of undefined.
I am left puzzled as to why assigning to this.metadata (which is an array of Metadatum objects) results in undefined.