object check

Benchmark created on


Setup

const o = 'object'
const vals = [{}, null, '', 1, true]

Test runner

Ready to run.

Testing in
TestOps/sec
constructor
vals.map(obj => obj?.constructor === Object)
ready
typeof A
vals.map(obj => typeof obj === 'object' && obj !== null)
ready
Object()
vals.map(obj => obj === Object(obj))
ready
typeof B
vals.map(obj => obj !== null && typeof obj === 'object')
ready
typeof C
vals.map(obj => typeof obj === o && obj !== null)
ready

Revisions

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