Okay, so essentially what is happening here is that the function validSet is being sent input, which appears to be a character string, and some set or array of values. The for loop is meant to iterate over the characters in the input string and determine if they are present in the provided set which I would assume contains the values 0-9. If the character that input.charAt(i) points to is not contained within the provided set then the function returns false and thus you know the input string is not a valid phone number since it contains some value that is not a digit.
This being said, I would also take this function further to truly check if the value entered is a valid phone number. I.e. make sure it is the correct length and other possible validity checks depending on how much it matters.