My current task involves retrieving data from an API that provides me with a collection of items. Each item consists of a string labeled correct_answer
and an array named incorrect_answers
.
I am in the process of merging these values within each item so that when I utilize v-for
, it will iterate through the combined answers in a single loop. Additionally, I aim to randomize the sequence of these answers.
Here is an illustration of what the object resembles:
"results": [
{
"question": "Where was the Games of the XXII Olympiad held?",
"correct_answer": "Moscow",
"incorrect_answers": [
"Barcelona",
"Tokyo",
"Los Angeles"
]
},
{
"question": "What is the first weapon you acquire in Half-Life?",
"correct_answer": "A crowbar",
"incorrect_answers": [
"A pistol",
"The H.E.V suit",
"Your fists"
]
},
]