.constructor vs typeof

Benchmark created on


Setup

var stringToCheck = "hello"

Test runner

Ready to run.

Testing in
TestOps/sec
.constructor === String
if (stringToCheck.constructor === String) {}
ready
typeof stringToCheck === 'string'
if (typeof stringToCheck === 'string') {}
ready

Revisions

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