什么是“未定义 x 1"?在 JavaScript 中? [英] What is "undefined x 1" in JavaScript?
问题描述
我正在根据这篇博客文章.
我正在 Google Chrome 的调试器中进行这项研究,困难的部分来了.
I am doing this research in Google Chrome's debugger and here comes the hard part.
我知道我无法删除局部变量(因为它们不是对象属性).我知道我可以从名为arguments"的数组中读出"传递给函数的所有参数.我什至知道我不能删除和数组的元素,只能实现 array[0]
的值为 undefined.
I get the fact that I can't delete local variables (since they are not object attributes). I get that I can 'read out' all of the parameters passed to a function from the array called 'arguments'. I even get it that I can't delete and array's element, only achieve to have array[0]
have a value of undefined.
有人可以向我解释一下嵌入图像中 undefined x 1
的含义吗?
Can somebody explain to me what undefined x 1
means on the embedded image?
当我覆盖函数 foo
以返回 arguments[0]
,然后我得到通常和正常"未定义.
And when I overwrite the function foo
to return the arguments[0]
, then I get the usual and 'normal' undefined.
这只是一个实验,但看起来很有趣,有人知道 undefined x 1
指的是什么吗?
This is only an experiment, but seems interresting, does anybody know what undefined x 1
refers to?
推荐答案
这似乎是 Chrome 在数组(和类数组 对象)中显示未初始化索引的新方式:
That seems to be Chrome's new way of displaying uninitialized indexes in arrays (and array-like objects):
> Array(100)
[undefined × 100]
这肯定比打印 [undefined, undefined, undefined,...]
或之前的打印效果更好.
Which is certainly better than printing [undefined, undefined, undefined,...]
or however it was before.
虽然,如果只有一个 undefined
值,他们可以删除 x 1
.
Although, if there is only one undefined
value, they could drop the x 1
.
这篇关于什么是“未定义 x 1"?在 JavaScript 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!