Explanation and JavaScript logic for 'phoneCheck'