Check if string

Benchmark created by Richard van Velzen on


Setup

var a, b = 'string';
    // c remains undefined

Test runner

Ready to run.

Testing in
TestOps/sec
concat 1
a + '' === a;
ready
typeof 1
typeof a === 'string';
ready
concat 2
b + '' === b;
ready
typeof 2
typeof b === 'string';
ready
concat 3
c + '' === c;
ready
typeof 3
typeof c === 'undefined';
ready

Revisions

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

  • Revision 1: published by Richard van Velzen on