title: Is there anything that guarantees constant time for accessing a property of an object in JavaScript?
body: <p>This is in regards to a debate I had with an interviewer when I was interviewing at Amazon.</p>
  
  <p>Let's I create an object: </p>
  
  <pre><code>var Obj = {};
  Obj['SomeProperty'] = function ( ) { console.log("Accessed some property"); };
  Obj[69] = true;
  </code></pre>
  
  <p>Is there anything in the JavaScript <strong>guarantee</strong>ing that when I subsequently access those 2 properties like <code>Obj['SomeProperty']</code> and <code>Obj[69]</code> the respective values <code>function ( ) { console.log("Accessed some property"); };</code> and <code>69</code> are looked up in O(1) time? I know the access operator <code>[]</code> gives a seasoned programmer the impression that he's dealing with an O(1) lookup structure, but can't it be possible for a JavaScript engine to implement <code>Object</code> in a way such that properties are <strong>not</strong> looked up in O(1)? </p>