slice vs length - 1 (v13)

Revision 13 of this benchmark created on


Setup

var x = "#/1fdefg/2fdsfe";

Test runner

Ready to run.

Testing in
TestOps/sec
slice
var y = x.replace("#/", "").split("/").slice(-1)[0]
ready
length - 1
var y = x.replace("#/", "").split("/")[x.replace("#/", "").split("/").length - 1]
ready

Revisions

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