铬devtools不一致数组的长度 [英] chrome devtools inconsistency array length

查看:114
本文介绍了铬devtools不一致数组的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎对在Chrome DevTools的不一致已经迷迷糊糊。

I seem to have stumbled upon an inconsistency in Chrome DevTools.

以上是从devtools截图。起初,有人告诉我,打印对象包含机身。头部应该是长度为1的数组当我扩大,这阵突然变得长度为2

Above is a screenshot from the devtools. At first I am told that the printed object contains a Body and a Head. The head should be an array of length 1. When I expand, this array suddenly becomes length 2.

在扩大问题数组我得到以下;

When expanding the array in question I get the following;

所以,似乎有数组中的一个空字符串为好。这空字符串是什么原因造成的一些问题,我的code这是什么原因促使我进行调查。我主要关心的是DevTools输出虽然,有谁能够想到的一个原因devtools会给两种不同长度为同一阵列?

So there seems to be an empty string in the array as well. This empty string is what is causing some problems with my code which is what prompted me to investigate. I am mostly concerned with the DevTools output though, can anybody think of a reason why devtools would give two different lengths for the same array?

是否DevTools长度的一个数组的内容自动解析到一个单独的变量?我本来期望头:数组[2] 在这种情况下。

Does DevTools automatically parse the content of an array of length one to a seperate variable? I would have expected Head: [Array[2]] in that case.

我使用的console.log 输出在Chrome开发工具的截图上市的Ubuntu VirtualBox的。

I am using console.log to output the listed screenshot in Chrome Dev tools on an ubuntu virtualbox.

推荐答案

这是因为初始显示,一个与格式为:

This is because the initial display, the one with this format:

Object {Body: Array[20], Head: Array[1]}

在控制台首次登录其产生。扩大后,它加载的所有对象的属性,如果属性已记录它,打开它的变化中,它会显示不同的值。您可以在淡蓝色的盘旋我显示后面的对象,看看有什么说的Chrome这个本身。

is generated when the console first logs it. After expanding, it loads all of the object's properties, and if the properties have changed in between logging it and opening it, it will show different values. You can hover over the light-blue i that shows behind the object to see what Chrome says about this itself.

这篇关于铬devtools不一致数组的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆