title: Can I set the type of a Javascript object?
body: <p>I'm trying to use some of the more advanced OO features of Javascript, following Doug Crawford's "super constructor" pattern. However, I don't know how to set and get types from my objects using Javascript's native type system. Here's how I have it now:</p>
  
  <pre><code>function createBicycle(tires) {
      var that = {};
      that.tires = tires;
      that.toString = function () {
          return 'Bicycle with ' + tires + ' tires.';
      }
  }</code></pre>
  
  <p>How can I set or retrieve the type of my new object? I don't want to create a <code>type</code> attribute if there's a right way to do it.</p>
  
  <h2>Is there a way to override the <code>typeof</code> or <code>instanceof</code> operators for my custom object?</h2>