Test name | Executions per second |
---|---|
Array.prototype.concat | 15783.0 Ops/sec |
spread operator | 41593.8 Ops/sec |
Push | 11164103.0 Ops/sec |
function randomArray(length, max) {
return Array.apply(null, Array(length)).map(function() {
return Math.round(Math.random() * max);
});
}
var arr = randomArray(10000, 15);
var other = arr.concat(1);
var other = [arr, 1]
var other = arr.push(1);