Substr test

Benchmark created on


Preparation HTML

<div class="slider_items" style="left: -517px;"></div>

Setup

const container = document.querySelector('.slider_items');

Test runner

Ready to run.

Testing in
TestOps/sec
Variable variant
theLeft = container.style.left;
current = theLeft.substr(0, theLeft.length-2);
ready
Double value get
current = container.style.left.substr(0, container.style.left.length-2);
ready

Revisions

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