May 4th, 2024
What's missing in this code?
// Check if number has all 0-9 digits
// isPandigitial(94180723658910) -> true
// isPandigital(9087452348109) -> false (6 is missing)
// isPandigitial(112233445566778899) -> false (0 is missing)
function isPandigital(number) {
const numStr = number.toString();
const digits = new Set();
for (const char of numStr) {
const digit =
(char, 10);
if (
(digit)) {
return false;
}
digits.add(digit);
}
return digits.size ===
;
}
Type or select from these options