Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0
Firefox 134
Mac OS X 10.15
Desktop
one month ago
Test name Executions per second
Array.prototype.slice 692067.9 Ops/sec
spread operator 30884.6 Ops/sec
Script Preparation code:
AخA
 
var arr = Array.from({length: 10000}, () => Math.random())
Tests:
  • Array.prototype.slice

     
    var other =  arr.slice();
  • spread operator

     
    var other = [ ...arr ]