To Detect Params is not null

Benchmark created on


Preparation HTML

<script>
  function usingTernary(param) {
    return param == null ? param : "default";
  }
  
  function usingOr(param) {
    return param || "default";
  }
  var nullValue = null;
  var notNullValue = "i have value";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Ternary (null)
usingTernary(nullValue);
ready
Ternary (not null)
usingTernary(notNullValue);
ready
Or (null)
usingOr(nullValue);
ready
Or (not null)
usingOr(notNullValue);
ready

Revisions

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