title: JavaScript: Converting a flat array into a tree like structure without using `eval`
body: <p>I have an array like this <code>["aaa","aaa","bbb","ccc"]</code>.</p>
  
  <p>what I need is convert it into a form like this:</p>
  
  <pre><code>{ "aaa" :
    { "aaa" :
      { "bbb" :
        { "ccc" : 1 }
      }
    }
  }
  </code></pre>
  
  <p>I know <code>eval</code> can do the trick, however is there any prettier solution?</p>
  
  <p>Thank you for reading my post.</p>