const D = "16,84"; function num(n) { let [a, b] = n.toString().split(/\D/).map(Number); b || (b = 0); console.log(a, b) } num(D);