JS isArray Comparison (v4)

Revision 4 of this benchmark created on


Setup

var a = [];
    var b = undefined;
    var c = null;

Test runner

Ready to run.

Testing in
TestOps/sec
Object.prototype.toString
Object.prototype.toString.call(a) === '[object Array]';
Object.prototype.toString.call(b) === '[object Array]';
Object.prototype.toString.call(c) === '[object Array]';
ready
Array.isArray
Array.isArray(a);
Array.isArray(b);
Array.isArray(c);
ready
instanceof
a instanceof Array
b instanceof Array
c instanceof Array
ready
.constructor === Array
a && a.constructor === Array
b && b.constructor === Array
c && c.constructor === Array
ready

Revisions

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