у меня есть запрос POST с некоторыми данными, я отправляю с помощью Postman, такие данные, но у меня есть проблема, когда я console.log(newLesson)
я не могу получить значение в [массиве], но когда я пытаюсь console.log(req.body.quizs)
его можно !!! Кто-нибудь может мне объяснить, почему? И как я могу получить из этого ценность? Большое спасибо ?
"name":"This is name",
"videoId" : "this is videoId",
"level" : "beginner",
"script" : "this is Script",
"quizs" : [
{
"question" : "This is question 1",
"answer" : [
"Answer 1",
"Answer 2",
"Answer 3"
],
"correct_Answer" : "Answer 3"
},
{
"question" : "This is question 2",
"answer" : [
"Answer 1",
"Answer 2",
"Answer 3"
],
"correct_Answer" : "Answer 1"
}
]
}
А это мой бэкэнд при получении
module.exports.addNewLesson = function(req,res){
let newLesson = {
name : req.body.name,
videoId : req.body.videoId ,
level : req.body.level,
script : req.body.script,
quizs : req.body.quizs
};
console.log(newLesson);
}
А вот что я получил
{
name: 'This is name',
videoId: 'this is videoId',
level: 'beginner',
script: 'this is Script',
quizs: [
{
question: 'This is question 1',
answer: [Array],
correct_Answer: 'Answer 3'
},
{
question: 'This is question 2',
answer: [Array],
correct_Answer: 'Answer 1'
}
]
}
Как получить answer : [Array]
??? Спасибо