JSFiddle - React, Tailwind, and code Playground
by _sir
HTML
<h3>Take an array and return the number of unique duplicates in it</h3>
<p>
<strong>Your answer should be: </strong>0, 1, 2
</p>
<div id="output"></div>
JavaScript
var arr = [[1, 2, 4],[1, 1, 1, 2, 3],[4, 2, 2, 3, 3, 3]];
var dupes = [];
arr.forEach(function(rec) {
var copy = rec.slice();
var single = [];
console.log(rec);
copy.forEach(function(item) {
if (!single.includes(item)) {
single.push(item);
}
})
console.log(single);
})
document.getElementById("output").innerHTML = '';