Quick reminder: trailing commas in object literals are legal in ECMAScript 5, trailing commas in arrays are ignored.
快速提醒:在ECMAScript 5中,对象文字中的尾随逗号是合法的,数组中的尾逗点将被忽略。
[4] In Internet Explorer 8 Object.defineProperty only accepts DOM objects (MSDN reference).
[4]在Internet Explorer 8中,Object.defineProperty只接受DOM对象(MSDN引用)。
[6] In Internet Explorer 8 Object.getOwnPropertyDescriptor only accepts DOM objects (MSDN reference).
[6]在Internet Explorer 8中,Object.getOwnPropertyDescriptor只接受DOM对象(MSDN引用)。
[7] Internet Explorer 6 - 8 do not differentiate between a dense array with undefined values, and a sparse array. Specifically, 0 in [,]
and 0 in [undefined]
both yield false - whereas in a compliant browser, the former would give false
, the latter true
. As such, ES5 array iteration methods can only be shimmed reliably when dealing with dense arrays.
[7] Internet Explorer 6 - 8不区分具有 undefined 的密集数组和稀疏数组。具体来说,在[,]中的0和[undefined]
中的0'都产生false - 而在兼容的浏览器中,前者会给出
false,后者是
true`。因此,ES5数组迭代方法只能在处理密集数组时可靠地填充。
In computer science, a sparse array is an array in which most of the elements have the default value (usually 0 or null). The occurrence of zero-value elements in a large array is inefficient for both computation and storage. An array in which there is a large number of zero elements is referred to as being sparse.
In the case of sparse arrays, one can ask for a value from an "empty" array position. If one does this, then for an array of numbers, a value of zero should be returned, and for an array of objects, a value of null should be returned.
在计算机科学中,稀疏数组是一个数组,其中大多数元素具有默认值(通常为0或null)。在大阵列中零值元素的出现对于计算和存储都是低效的。其中存在大量零个元素的阵列被称为是稀疏的。
在稀疏数组的情况下,可以从“空”数组位置请求一个值。如果这样做,那么对于数字数组,应该返回一个零值,对于一个对象数组,应该返回一个null值。
网友评论