js function type check

Benchmark created on


Preparation HTML

<script>
  var toString = Object.prototype.toString;
  var
  test1 = function() {},
      test2 = {},
      test3 = [],
      test4 = 1.2,
      test5 = true,
      test6 = Date,
      test7 = new Boolean,
      test8 = null,
      test9;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Object.prototype.toString
toString.call(test1);
toString.call(test2);
toString.call(test3);
toString.call(test4);
toString.call(test5);
toString.call(test6);
toString.call(test7);
toString.call(test8);
toString.call(test9);
ready
typeof
typeof test1;
typeof test2;
typeof test3;
typeof test4;
typeof test5;
typeof test6;
typeof test7;
typeof test8;
typeof test9;
ready

Revisions

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