So I have 2 JS functions, loadReport is calling getCurrentReport. I've checked that I do have the correct object before returning, and yet the caller does not receive that object. Why?
getCurrentReport(id) {
this.reports.forEach(e => {
if (e.id === id) {
console.log(e); // This prints exactly the object that I want
return e; // So I assume I should get this object..
}
});
}
async loadReport(id) {
var report = this.getCurrentReport(id);
console.log("Getting:");
console.log(report); // And yet I'm getting undefined here?
},
Someone please explain to me?