Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/414.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在[Array]中获取完整值?_Javascript_Arrays_Json_Object - Fatal编程技术网

Javascript 如何在[Array]中获取完整值?

Javascript 如何在[Array]中获取完整值?,javascript,arrays,json,object,Javascript,Arrays,Json,Object,我有一个带有一些数据的POST请求,我和邮递员一起发布,像这样的数据,但我有一些问题是当我console.log(newLesson)我无法在[Array]中获取值,但当我尝试console.log(req.body.quizs)它可以!!!谁能给我解释一下原因吗?我怎样才能从中获得价值呢?非常感谢尝试使用格式字符串化输出: console.log(JSON.stringify(newLesson, null, 4)); // 4 is the number of whitespaces use

我有一个带有一些数据的POST请求,我和邮递员一起发布,像这样的数据,但我有一些问题是当我
console.log(newLesson)
我无法在[Array]中获取值,但当我尝试
console.log(req.body.quizs)
它可以!!!谁能给我解释一下原因吗?我怎样才能从中获得价值呢?非常感谢尝试使用格式字符串化输出:

console.log(JSON.stringify(newLesson, null, 4)); // 4 is the number of whitespaces used for formatting 

尝试使用以下格式对输出进行字符串化:

console.log(JSON.stringify(newLesson, null, 4)); // 4 is the number of whitespaces used for formatting 

newLesson.quizs.map(x=>x.answer)
您无法仅在控制台日志中看到嵌套数组。在服务器端,它总是以这种格式显示,即使对于它不会显示的嵌套对象也是如此。您所能做的就是对整个数据进行字符串化,然后进行检查。它将工作
newLesson.quizs.map(x=>x.answer)
您无法在控制台日志中简单地看到嵌套数组。在服务器端,它总是以这种格式显示,即使对于它不会显示的嵌套对象也是如此。您所能做的就是对整个数据进行字符串化,然后进行检查。它会起作用的