Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135
Linux
Desktop
one month ago
Test name Executions per second
array.prototype.at() 159928672.0 Ops/sec
array[array.length - 1] 176036736.0 Ops/sec
Script Preparation code:
AخA
 
var array = [0, 1, 2, 3];
Tests:
  • array.prototype.at()

     
    let lastWithAtArray = array.at(-1)
  • array[array.length - 1]

     
    let lastWithLength = array[array.length - 1]