У меня здесь есть какой-то фальшивый вопрос об объекте (не берите в голову вопрос и выбор, который они бредят)
const questions = {
iq_test: {
questions: [
{
question: 'Find the difference',
choices: ['a1', 'a2', 'a1', 'a3'],
correct: 0
},
{
question: 'What is the next sequence',
choices: ['2', '5', '56', '64'],
correct: 3
},
{ question: 'What should be the next letter',
choices: ['c', 'z', 'e', 'f'],
correct: 3
}]
},
memory_test: {
...omitted
}
}
Теперь я хочу iq_test
let retQuestions = Object.values(questions.iq_test).map(item => {
console.log(item);
return item;
})
Console.log внутри карты дает мне этот формат
[ { question: 'Find the difference',
choices: [ 'a1', 'a2', 'a1', 'a3' ],
correct: 0 },
{ question: 'What is the next sequence',
choices: [ '2', '5', '56', '64' ],
correct: 3 },
{ question: 'What should be the next letter',
choices: [ 'c', 'z', 'e', 'f' ],
correct: 3 } ]
Но когда я console.log возвращаю retQuestions, которые должны содержать возвращаемое значение, я получаю другой формат
console.log (retQuestions)как вы можете видеть ниже, он превращается в 2d массив
[ [ { question: 'Find the difference', choices: [Array], correct: 0 },
{ question: 'What is the next sequence',
choices: [Array],
correct: 3 },
{ question: 'What should be the next letter',
choices: [Array],
correct: 3 } ] ]
Я хочу снова отобразить на этот раз ретроспективы, чтобы получить каждый вопрос, но не могу, так как формат меняется ..