Test with questions and answers in an object in JavaScript
In the previous lesson, our questions and answers were stored in different variables. This separation can often be inconvenient. Let's work with other storage options.
Let questions and answers be stored in such an object:
let questions = {
'Question 1?': 'answer 1',
'Question 2?': 'answer 2',
'Question 3?': 'answer 3',
}
Solve the problem of creating a test for such a data storage option
Let questions and answers be stored in such an object:
let questions = [
{
text: 'question 1?',
right: 'answer 1',
},
{
text: 'question 2?',
right: 'answer 2',
},
{
text: 'question 3?',
right: 'answer 3',
},
];
Solve the problem of creating a test for such a data storage option.