Test with questions and answers in an array in JavaScript

Suppose we have an array of correct answers, as in the previous lesson:

let answers = [ 'answer 1', 'answer 2', 'answer 3', ];

Let now an array of questions be given:

let questions = [ 'question 1?', 'question 2?', 'question 3?' ];

Let the divs with questions and inputs for answers no longer exist in the HTML code:

<div id="test"></div> <button id="button">check answers</button>

Let us face the same task: by clicking on the button, check the correctness.

Obviously, our task has become more complicated: now, upon entering the page, we need to iterate through the array of questions and generate the HTML code for each question - the parent div, a paragraph with text, and an input for the answer.

Implement the assigned task.

enru