const digits = Object
.entries([...`${num}`].reduce((acc, n) => (acc[n] = (acc[n] || 0) + 1, acc), {}))
.reduce((acc, n) => (n[1] > 1 && acc.push(+n[0]), acc), []);
или
const digits = num
.toString()
.split('')
.reduce((acc, n) => (acc[n]++, acc), Array(10).fill(0))
.map((n, i) => n > 1 && i)
.filter(n => n !== false);
или
const digits = Array
.from(String(num), Number)
.filter((n, i, a) => i !== a.indexOf(n))
.filter((n, i, a) => i === a.indexOf(n));
или
const digits = (('' + num)
.match(/\d/g)
.sort()
.join('')
.match(/(\d)\1+/g) || [])
.map(n => n[0] | 0);