Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
array or string array[array.length - 1] vs array.at(-1) vs array[len -1]
(version: 0)
Comparing performance of:
array[array.length - 1] vs array.at(-1) vs array[len - 1]
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const array = [1,2,3]; const string = 'akdbajshdas';
Tests:
array[array.length - 1]
const d = array[array.length - 1]; const d1 = string[string.length - 1];
array.at(-1)
const z = array.at(-1); const z1 = string.at(-1);
array[len - 1]
const len = array.length; const a = array[len - 1]; const len1 = string.length; const a1 = string[len1 - 1];
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
array[array.length - 1]
array.at(-1)
array[len - 1]
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?