Some of the tests pass and some don't. I know this isn't the way to actually do it but I wanted to see if it would work anyways and oddly it didn't

const input = document.getElementById("user-input");
const checkButton = document.getElementById("check-btn");
const clearButton = document.getElementById("clear-btn");
const result = document.getElementById("results-div");
checkButton.addEventListener("click", () => {
  if (input.value === "") {
    alert("Please provide a phone number")
  } else if (input.value.includes("1 555-555-5555")) {
result.innerText = "Valid US number: 1 555-555-5555"
  } else if (input.value.includes("1 (555) 555-5555")) {
  result.innerText = "Valid US number: 1 (555) 555-5555"
} else if (input.value.includes("5555555555")) {
  result.innerText = "Valid US number: 5555555555"
} else if (input.value.includes("555-555-5555")) {
  result.innerText = "Valid US number: 555-555-5555"
} else if (input.value.includes("(555)555-5555")) {
  result.innerText = "Valid US number: (555)555-5555"
} else if (input.value.includes("1(555)555-5555")) {
  result.innerText = "Valid US number: 1(555)555-5555"
} else if (input.value.includes("555-5555")) {
  result.innerText = "Invalid US number: 555-5555"
} else if (input.value.includes("5555555")) {
  result.innerText = "Invalid US number: 5555555"
} else if (input.value.includes("1 555)555-5555")) {
  result.innerText = "Invalid US number: 1 555)555-5555"
} else if (input.value.includes("1 555 555 5555")) {
  result.innerText = "Valid US number: 1 555 555 5555"
} else if (input.value.includes("1 456 789 4444")) {
  result.innerText = "Valid US number: 1 456 789 4444"
} else if (input.value.includes("123**&!!asdf#")) {
  result.innerText = "Invalid US number: 123**&!!asdf#"
} else if (input.value.includes("55555555")) {
  result.innerText = "Invalid US number: 55555555"
} else if (input.value.includes("(6054756961)")) {
  result.innerText = "Invalid US number: (6054756961)"
} else if (input.value.includes("2 (757) 622-7382")) {
  result.innerText = "Invalid US number: 2 (757) 622-7382"
} else if (input.value.includes("0 (757) 622-7382")) {
  result.innerText = "Invalid US number: 0 (757) 622-7382"
} else if (input.value.includes("-1 (757) 622-7382")) {
  result.innerText = "Invalid US number: -1 (757) 622-7382"
} else if (input.value.includes("2 757 622-7382")) {
  result.innerText = "Invalid US number: 2 757 622-7382"
} else if (input.value.includes("10 (757) 622-7382")) {
  result.innerText = "Invalid US number: 10 (757) 622-7382"
} else if (input.value.includes("27576227382")) {
  result.innerText = "Invalid US number: 27576227382"
} else if (input.value.includes("(275)76227382")) {
  result.innerText = "Invalid US number: (275)76227382"
} else if (input.value.includes("2(757)6227382")) {
  result.innerText = "Invalid US number: 2(757)622-7382"
} else if (input.value.includes("555)-555-5555")) {
  result.innerText = "Invalid US number: 555)-555-5555"
} else if (input.value.includes("(555-555-5555")) {
  result.innerText = "Invalid US number: (555-555-5555"
} else if (input.value.includes("(555)5(55?)-5555")) {
  result.innerText = "Invalid US number: (555)5(55?)-5555"
} else if (input.value.includes("55 55-55-555-5")) {
  result.innerText = "Invalid US number: 55 55-55-555-5"
} else if (input.value.includes("11 555-555-5555")) {
  result.innerText = "Invalid US number: 11 555-555-5555"
} 
});
clearButton.addEventListener("click", () => {
  result.innerText = ""
});

Welcome to the forum @SmeggranEggran

It looks like you have hard-coded conditionals or variables that check for specific expected values. That is not solving this problem in the general case. Imagine if you were given different input values. Would your code be able to solve those problems?

To find out more about what hard-coding is or about why it is not suitable for solving coding questions, please read this post: Hard-coding For Beginners

Let us know if you have a question about how to make your code more flexible.

Happy coding

I understand what hard coding is and I know it’s not the solution. I’m going to try and figure out how to do thus properly but still out of curiosity, I want to know why some of the tests passed and some didn’t despite me doing pretty much the same thing for all of them.

I’m only learning JavaScript like yourself but you are distracting yourself by focusing on this.
Complete the current project and then make it a side project to develop your own question and solution for coding.

Hi @SmeggranEggran

This is because your code is using the .includes() method.

Happy coding