if-else or ternary

Benchmark created on


Setup

const a = 10;
let b;

Test runner

Ready to run.

Testing in
TestOps/sec
if-else
if (a < 3) {
	b = 0;
} else {
	b = a;
}
ready
ternary
b = a < 3 ? 0 : a;
ready

Revisions

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