ternary operator vs. if statement (v6)

Revision 6 of this benchmark created on


Setup

var x=Math.floor(Math.random()*2);

Teardown



            x=Math.floor(Math.random()*2);
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
ternary operator
x = x ? true : false;
ready
if statement
if (x){
  x = true;
}else{
  x = false;
}
ready

Revisions

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