Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
slice 11003586.0 Ops/sec
push 3166164.8 Ops/sec
Script Preparation code:
AخA
 
var data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
Tests:
  • slice

     
    data.slice(3, 8).forEach(x => x + 1);
  • push

     
    for (var i = 3; i < 8; i++) {
      data[i] + i
    }