title: How to find duplicate values in nested data like this
body: <p>I need a function to find duplicate colors in that kind of nested data</p>
  
  <p>['black', 'white', 'red', 'black',[ 'black', 'purple', 'blue',[ 'purple', 'yellow', 'green', 'gray'], 'purple']]</p>
  
  <p>expected result:</p>
  
  <pre><code>(2) ["Purple", "Yellow"]
  </code></pre>
  
  <p>Tried:</p>
  
  <pre><code>var color=['Blue', 'Red', 'Purple', 'Grey', 'Purple', 'Yellow', 'Yellow']
  
  var uniq = color
  .map((name) =&gt; {
    return {count: 1, name: name}
  })
  .reduce((a, b) =&gt; {
    a[b.name] = (a[b.name] || 0) + b.count
    return a
  }, {})
  
  var duplicates = Object.keys(uniq).filter((a) =&gt; uniq[a] &gt; 1)
  
  console.log(duplicates)
  </code></pre>