ternary vs &&

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
&&
const a = 1;
const b = undefined;
const c = a && '1'
const d = b && '2'
ready
tern
const a = 1;
const b = undefined;
const c = a ? '1' : undefined
const d = b ? '2' : undefined
ready

Revisions

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