value.constructor vs Array.isArray() (v24)

Revision 24 of this benchmark created on


Setup

var A = [1, 2, 3],
  B = { name: 'hello' },
  C = 1,
  D = null,
  E = undefined

Test runner

Ready to run.

Testing in
TestOps/sec
IsArray A
Array.isArray(A) ? true : false;
ready
IsArray B
Array.isArray(B) ? true : false;
ready
IsArray C
Array.isArray(C) ? true : false;
ready
IsArray D
Array.isArray(D) ? true : false;
ready
IsArray E
Array.isArray(E) ? true : false;
ready
Constructor of A
(A && A.constructor) === Array ? true : false;
ready
Constructor of B
(B && B.constructor) === Array ? true : false;
ready
Constructor of C
(C && C.constructor) === Array ? true : false;
ready
Constructor of D
(D && D.constructor) === Array ? true : false;
ready
Constructor of E
(E && E.constructor) === Array ? true : false;
ready
instanceof A
A instanceof Array ? true : false
ready
instanceof B
B instanceof Array ? true : false
ready
instanceof C
C instanceof Array ? true : false
ready
instanceof D
D instanceof Array ? true : false
ready
instanceof E
E instanceof Array ? true : false
ready

Revisions

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