Test name | Executions per second |
---|---|
Array.prototype.slice() | 10496613.0 Ops/sec |
spread operator | 9644930.0 Ops/sec |
Array.prototype.slice(0) | 11197079.0 Ops/sec |
var baseArray = []
for (var i = 0; i < 50; i++) {
baseArray.push((Math.floor(Math.random() * Math.floor(1000000))).toString(16))
}
var other = baseArray.slice();
var other = [ baseArray ]
var other = baseArray.slice(0);