!isNaN, typeof === number (v2)

Revision 2 of this benchmark created on


Setup

var num = 5,
        notnum = '5';

Test runner

Ready to run.

Testing in
TestOps/sec
isNaN
if (!isNaN(num)) {
  console.log('hi');
}

if (!isNaN(notnum)) {
  console.log('hi');
}
ready
typeof
if (typeof num === 'number') {
  console.log('hi');
}

if (typeof notnum === 'number') {
  console.log('hi');
}
ready

Revisions

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