Test Object Property Lookup

Benchmark created by Daniel Bartlett on


Setup

var Obj = {
    a: 'a value',
    b: 'b value',
    c: 'c value',
    d: 'd value'
    e: 'e value', 
    f: 'f value'
    g: 'g value', 
    h: 'h value'
    i: 'i value', 
    j: 'j value'
  };

Test runner

Ready to run.

Testing in
TestOps/sec
Test hasOwnProperty
if(Obj.hasOwnProperty('j')) {
  return true;
} else {
  return false;
}
ready
Test typeof
if(typeof Obj['j'] !== 'undefined') {
  return true;
} else {
  return false;
}
ready

Revisions

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

  • Revision 1: published by Daniel Bartlett on