title: How to convert array into nested objects in javascript
body: <p>I am trying to generate nested object from nested array using javascript. But so far not able to succeed.</p>
  
  <p>Below is array example.</p>
  
  <pre><code>let arr = [
        '25',
        '25_29',
        '25_28',
        '25_28_35',
        '25_28_35_36',
        '20',
        '20_27',
        '20_26',
        '18',
        '18_48',
        '59',
        '34'
      ];
  </code></pre>
  
  <p>Below is object example.</p>
  
  <pre><code>let Obj = {
        25: {
          key: 25,
          child: {
            29: {
              key: 29, child: {}
            },
            28: {
              key: 28,
              child: {
                key: 35,
                child: {
                  key: 36,
                  child: {}
                }
              }
            }
          }
        },
        20: {
          key: 20,
          child: {
            27: {
              key: 27,
              child: {}
            },
            26: {
              key: 26,
              child: {}
            }
          }
        }
      }
  </code></pre>
  
  <p>Is there any possibility of doing same?</p>