comparing underscore.js 'isFunction' with 'typeof function' (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://underscorejs.org/underscore.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
underscore isFunction
var obj = function() {
  console.log("test")
};
return toString.call(obj) == '[object Function]';
ready
typeof 'function'
var obj = function() {
  console.log("test")
};
return 'function' === typeof obj;
ready
Actual _.isFunction
var obj = function() {
  console.log("test")
};
return _.isFunction(obj);
ready
$.isFunction
var obj = function() {
  console.log("test")
};
return $.isFunction(obj);
ready

Revisions

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