I receive answer from a form. I receive an array with objects where each object correspond to the answer of one question:
I want to access the answer.
First I was thinking to ask to use answers[i].t
(for example), but the problem is that the number of the question depends of the answers submitted so I can’t use index of the array. So I had the idea to access to the answer by using the id of the question.
For example: object.t
where object.q === "64c3980b7e457155fed418db"
.
How can I do that in JavaScript?
2
Answers
Use the find method: