Armen,
<script>
var arr = [0, 0, 4, 8, 8, 10, 45, 0, 23, 3, 8],
result = [],
temp = {};
arr.forEach(function(item, index, array) {
temp[item] ? (temp[item].push(item)) : (temp[item] = [item]);
});
Object.keys(temp).forEach(function(key) {
temp[key].length > 1 && result.push(temp[key])
});
document.write(JSON.stringify(result))
</script>
|