且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是什么凝聚阵列和阵列面值之间的区别?

更新时间:2023-01-13 22:48:44

后,没有在生成的目标没有什么区别,它们是相同的。

No, there is no difference in the produced object, they are the same.

首先是为了满足那些使用一个经典的环境中,你必须实例化一个新Array对象编程的一种尝试。

The first is an attempt to satisfy programmers that are use to a "classical" environment where you have to instantiate a "new" Array object.

应当注意的是,阵列中的JavaScript不是存储器的顺序分配,但具有可枚举属性名称和一些额外的(有用)的方法的对象

It should be noted that Arrays in javascript are not a sequential allocation of memory, but objects with enumerable property names and a few extra (useful) methods.

在大多数(如果不是全部)的情况下相当无用的和不必要的。

Because of this creating an array of a set length is fairly useless and unnecessary in most (if not all) cases.

var array = new Array(10);

在功能上同样是手动设置您的数组的长度

is functionally the same is manually setting the length of your array

var array = [];
array.length = 10;