const value = '2555-555-5555';
const regex = /(1s?)?(d{3}|(d{3}))[-s]?d{3}[-s]?d{4}/; //I found this is an incorrect regex
if (regex.test(value)) {
console.log(regex.test(value)); //is false
resultsDiv.querySelector("p").textContent = `Valid US number: ${value}`;
} else {
resultsDiv.querySelector("p").textContent = `Invalid US number: ${value}`;
}
The if condition here should not be executing.