Ternary vs array to set true/false for strings (v2)

Revision 2 of this benchmark created on


Setup

var test = "true";

Test runner

Ready to run.

Testing in
TestOps/sec
Ternary
test.toLowerCase()==="true"?true:false;
ready
Array
[,,,,true,false][test.length];
ready
Ternery 2 - w/o case changing
test==="true";
ready

Revisions

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