1function test_same_digit(num) {
2 const first = num % 10;
3 while (num) {
4 if (num % 10 !== first) return false;
5num = Math.floor(num / 10);
6 }
7 return true
8}
9
10console.log(test_same_digit(1234));
11console.log(test_same_digit(1111));
12console.log(test_same_digit(22222222));
13