Count level of object depth : <p>I have a <strong>javascript</strong> object and I would like to count the number of nested depth.</p>

<p>Example Object</p>

<p><strong>Answer</strong> should be equal 4 (count level depth)</p>

<pre><code>data: {
first: [
  {
    value: '',
    children: [
      {
       value: '',
       children: [
          {
            value: '',
            children: [
              {
                value: '',
                children: [],
              },
              {
                 value: '',
                children: [],
              },
            ],
          },
        ],
      },
    ],
  },
],
</code></pre>

<p></p>
