把数据插入数组尾部

JavaScript performance comparison

Test case created by zhangxiangliang

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
利用数组长度进行赋值
let arr = [1,2,3,4,5];
arr[arr.length] = 6;
pending…
利用 Array.prototype.push 方法
let arr = [1, 2, 3, 4, 5];
arr.push(6);
pending…
利用 Array.prototype.concat 方法
let arr = [1, 2, 3, 4, 5];
arr = arr.concat(6);
pending…
利用 spread 运算符
let arr = [1, 2, 3, 4, 5];
arr = [...arr, 6];
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments