Access last element of array

Benchmark created on


Setup

var arr = [1,2,3,4,5,6,7,8,9,10]

Test runner

Ready to run.

Testing in
TestOps/sec
using array length
arr[arr.length-1]
ready
using slice
arr.slice(-1)[0]
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.