typeof number vs unary plus (v7)

Revision 7 of this benchmark created by adsad on


Description

Typeof check when looking for number, vs unary +

Setup

var num = 42;
    var notNum = {};

Test runner

Ready to run.

Testing in
TestOps/sec
typeof
typeof num === 'number';
typeof notNum === 'number';
ready
unary +
num === + num;
notNum === +notNum;
ready
typeof with instanceOf
typeof num === 'number' || num instanceOf Number;
typeof notNum === 'number' || notNum instanceOf Number;
ready
unary + with instanceOf
typeof num === 'number' || num instanceOf Number;
typeof notNum === 'number' || notNum instanceOf Number;
ready

Revisions

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