Array.isArray vs instanceof Array vs _.isArray (v11)

Revision 11 of this benchmark created on


Preparation HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>

Setup

var a = [1, 2, 3];
    var s = 'example';
    var f = false;

Test runner

Ready to run.

Testing in
TestOps/sec
Array.isArray
Array.isArray(a)
ready
instanceof
a instanceof Array
ready
_.isArray
_.isArray(a)
ready
Array.isArray(boolean)
Array.isArray(f)
ready
instanceof (boolean)
f instanceof Array
ready
_.isArray(boolean)
_.isArray(f)
ready

Revisions

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