I have an array of objects. How do find and update the object with a new object? And if the object doesn’t exist, create it?
[
{
“question_id”: 2,
“user_choice”: “choice1”
},
{
“question_id”: 9,
“user_choice”: “choice2”
},
{
“question_id”: 7,
“user_choice”: “choice3”
},
{
“question_id”: 1,
“user_choice”: “choice4”
},
{
“question_id”: 5,
“user_choice”: “choice5”
}
]