When using an API to retrieve a response array, I encountered an issue trying to map the "id" under the "quiz_records" array as it kept returning undefined. Despite believing that my code was correct, I couldn't figure out the problem.
Here is the snippet of the array:
"quizRemarks": [
{
"id": 160,
"user_id": 1,
"quiz_id": 18,
"module_id": 29,
...
},
...
]
This is the TypeScript code segment I attempted:
this.quiz_records = res['quizRemarks'].map(res => res['quiz_records'].id);
console.log(this.quiz_records);