Angular14 how to get each item, which is an array, of an array

Viewed 7

I have following structure 1 questionnaire got many questionSection 1 questionSection got many questions

i want to get all the questions. I tried following

const allQuestions: Question[] = [];
questionSections.forEach(section => {
  section.questions.forEach(question => {  
    allQuestions.push(question)
  });
});

Is there a better way to achieve the same result?

Thanks

0 Answers
Related