My issue revolves around an array of objects. When I log the array, everything appears as expected. However, when I use the .length
function, it inexplicably returns a value of 0
.
Check out my code snippet:
async fetchTicketType(updatedTicket) {
await this.retrieveTicketTypes();
if (this.ticketOptions) {
console.log('I reached this point');
console.log(this.ticketOptions);
console.log(this.ticketOptions.length);
for (let i = 0; i < this.ticketOptions.length; i++) {
console.log('I reached this point');
if (this.ticketOptions[i]["value"] === updatedTicket) {
this.selectedTicketOption = this.ticketOptions[i];
}
}
}
}
Here's a snapshot of the logs: