const answerQuestionId = [
[{
corretta: false,
domanda_id: 1,
id: "1",
immagine: false,
testo: "Risposta_1",
},
{
corretta: false,
domanda_id: 1,
id: "2",
immagine: false,
testo: "Risposta_2",
},
{
corretta: false,
domanda_id: 1,
id: "3",
immagine: false,
testo: "Risposta_3",
},
{
corretta: false,
domanda_id: 1,
id: "4",
immagine: false,
testo: "Risposta_4",
},
],
[{
corretta: false,
domanda_id: 2,
id: "1",
immagine: false,
testo: "Two_1",
},
{
corretta: false,
domanda_id: 2,
id: "2",
immagine: false,
testo: "Two_2",
},
{
corretta: false,
domanda_id: 2,
id: "3",
immagine: false,
testo: "Two_3",
},
{
corretta: false,
domanda_id: 2,
id: "4",
immagine: false,
testo: "Two_4",
},
],
[{
corretta: false,
domanda_id: 3,
id: "1",
immagine: false,
testo: "Three_1",
},
{
corretta: false,
domanda_id: 3,
id: "2",
immagine: false,
testo: "Three_2",
},
{
corretta: false,
domanda_id: 3,
id: "3",
immagine: false,
testo: "Three_3",
},
{
corretta: false,
domanda_id: 3,
id: "4",
immagine: false,
testo: "Three_4",
},
],
[{
corretta: false,
domanda_id: 4,
id: "1",
immagine: false,
testo: "Four_1",
},
{
corretta: false,
domanda_id: 4,
id: "2",
immagine: false,
testo: "Four_2",
},
{
corretta: false,
domanda_id: 4,
id: "3",
immagine: false,
testo: "Four_3",
},
{
corretta: false,
domanda_id: 4,
id: "4",
immagine: false,
testo: "Four_4",
},
],
];
const result = answerQuestionId.map(item => item.map(innerItem => innerItem.testo));
console.log(result);
console.log(result[0][0]);
answerQuestionId?[0], try this oneconsole.log(answerQuestionId.map(element =>${element.testo}));let answerQuestionId = questions.map((q, a) => { let temp = answers.filter( (element) =>${element.domanda_id}` ===${q.id}); return temp; });` where questions and answers were 2 arrays of objects and the answes had a field for the question_id