0👍
✅
The numbers you accept the factor of 111.
let num = 111;
if (num < 1000) {
if (Number.isInteger(num / 111)) {
console.log(true);
} else {
console.log(false)
}
} else {
// create the validation rules for the numbers that bigger than 999
}
Source:stackexchange.com