My code is failing the test cases "should remove paren, spaces, hyphens, and dots" and "should validate when 11 digits and starting with 1 even with punctuation".
It was previously passing the removal characters case then stopped after adding more stuff and I can't figure out what it is. The logs show pNum stripped of these characters but it's still failing?
Help me debug? Here are the tests/results: https://puu.sh/ziot6/8982a12ad0.png
const phoneNumber = (pNum) => {
  var replaceChars = /[.)( -]/g;
  //removes parenthesis, spaces, hyphens, and dots
  pNum = pNum.replace(replaceChars,"");
  console.log(pNum);
  //returns pNum if length is 11 and starts with 1
  if (pNum.length == 11 && pNum[0] == 1)
      return pNum;
  //returns pNum if length is 11 and starts with 1 and has punctuation
  if (pNum.length == 11 && pNum[0] == 1 && pNum.match(/\W/g))
      return pNum;
  //returns null if pNum is equal or less than 9 or more than 11
  if (pNum.length <= 9 || pNum.length > 11)
      return null;
  //returns null if pNum is 11 without 1 in the first index
  if (pNum.length == 11 && pNum[0] !== 1)
      return null;
  //returns null if pNum has letters or punctuation and less than 11
  if (pNum.match(/[a-z]/i) && pNum.length !== 11)
      return null;
  //return null when area code does not start 2-9
  if (pNum.length == 10 && pNum[0] != ('2','3','4','5','6','7','8','9'))
      return null;
  if (pNum.length == 11 && pNum[1] != ('2','3','4','5','6','7','8','9'))
      return null;
  //return null when exchange code does not start 2-9
  if (pNum.length == 10 && pNum[3] != ('2','3','4','5','6','7','8','9'))
      return null;
  if (pNum.length == 11 && pNum[4] != ('2','3','4','5','6','7','8','9'))
      return null;
}
 
    