typeof

Benchmark created by Mike Wilcox on


Description

Is typeof faster than truthy tests?

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
typeof
var o;
var r1 = typeof o !== "undefined";
var d = dojo;
var r2 = typeof d !== "undefined";
 
ready
truthy
var o;
var r1 = !!o
var d = dojo;
var r2 = !!d;
ready

Revisions

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

  • Revision 1: published by Mike Wilcox on