Check if object has property (v4)

Revision 4 of this benchmark created on


Description

Comparing use of prop in object vs. typeof object !== 'undefined'

Setup

window.checkObjectTestExample = { 'pronic': 42 };

Teardown


    delete window.checkObjectTestExample;
  

Test runner

Ready to run.

Testing in
TestOps/sec
prop in object
'pronic' in window.checkObjectTestExample
ready
typeof object
typeof window.checkObjectTestExample.pronic !== 'undefined'
ready
typeof object 2
typeof window.checkObjectTestExample['pronic'] !== 'undefined'
ready

Revisions

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