title: How to make and object find its own index in an array?
body: <p>I have a simple array of objects with a <code>id</code> property and I need the ids to be equal to their index. I tried this</p>
  
  <pre><code>var arr = [
  
    {
      id: arr.indexOf(this),
      length: this.length
    },
     {
      id: arr.indexOf(this),
      length: this.length
    },
     {
      id: arr.indexOf(this),
      length: this.length
    }
  
  ]
  </code></pre>
  
  <p>But that doesn't work. Do I have to use a function outside the array to do this? None of the built in methods would help?</p>