function check_digit_exists(n: number, digit: number) {
while (n > 0) {
if (digit == n % 10) {
return true;
}
n = Math.floor(n / 10);
}
return false;
}
const num: number = 230168;
console.log(check_digit_exists(num, 1));
console.log(check_digit_exists(num, 5));
/*
run:
true
false
*/