I want to remove duplicate digits from n
. So what I expect is 123456789
. But when I do so using new Set()
below, I get 1234567890
with zero as the last digit. But there is no 0
in the original n
.
Can you explain this?
let n=112233445566778899;
console.log([...new Set(String(n).split(''))].join(''));