According to jsPerf: Last item method, the most performant method is array[array.length-1]
. The graph is displaying operations per second, not time per operation.
It is common (but wrong) for developers to think the performance of a single operation matters. It does not. Performance only matters when you're doing LOTS of the same operation. In that case, using a static value (length
) to access a specific index (length-1
) is fastest, and it's not even close.