title: Create a dynamic nested object from array of properties
body: <p>This sounds like a simple task, but I can't quite figure it out: I have an array :</p>
  
  <pre><code>var array = ['opt1','sub1','subsub1','subsubsub1']
  </code></pre>
  
  <p>From that I want to generate the following objects:</p>
  
  <pre><code>{
    opt1:{
      sub1:{
        subsub1:{
          subsubsub1:{}
        }
      }
    }
  }
  </code></pre>
  
  <p>I have a way to do it, making a string and using eval, but I'm looking to avoid that, any idea?</p>