TypeCheckTest

Benchmark created by Felipe Alfonso on


Setup

var a = 1;

Test runner

Ready to run.

Testing in
TestOps/sec
isNaN
if (isNaN(a * 'a')) {
  // do something
} else {
  console.log('fail');
}
ready
typeof
if (typeof a === 'number') {
  // do something
} else {
  console.log('fail');
}
ready
toString
if (Object.prototype.toString.call(a) === '[object Number]') {
  // do something
} else {
  console.log('fail');
}
ready

Revisions

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

  • Revision 1: published by Felipe Alfonso on