Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36
Chrome 118
Windows
Desktop
14 days ago
Test name Executions per second
Array.at() 71040160.0 Ops/sec
Index 64184620.0 Ops/sec
Script Preparation code:
AخA
 
const arr = Array(1000000).fill(0).map((_, i) => i)
Tests:
  • Array.at()

     
    const val = arr.at(-1);
  • Index

     
    const val = arr[arr.length - 1];