Truth with boolean vs string

Benchmark created by Kyle Florence on


Preparation HTML

<script>
  function truthyBoolean() {
   return true;
  }
  
  function truthyString() {
   return "string";
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Boolean
if (truthyBoolean()) {}
ready
String
if (truthyString()) {}
ready

Revisions

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

  • Revision 1: published by Kyle Florence on