title: JavaScript nth degree tree
body: <ol>
  <li>I need to change the clicked property to true of a parent if all children clicked are true. so in this case ID - 14,15 is having clicked property to true. So, parents having ID 11 clicked has to be made true.</li>
  <li>If 11,12,14,15 are true then then 4 has to be made true.</li>
  </ol>
  <pre><code>let obj = {children:[
  {
      ID:1,
      clicked: false,
      children: [
          {
              ID:4,
              clicked: false,
              children: [
                  {
                      ID:11,
                      clicked: false,
                      children: [
                                  {
                                      ID:14,
                                      clicked: true,
                                  },
                                  {
                                      ID:15,
                                      clicked: true,
                                  }
                              ]
                  },
                  {
                      ID:12,
                      clicked: false,
                  }
              ]
          },
          {
              ID:5,
              clicked: false,
          }
      ]
    }
   ]
  }
  
  </code></pre>