* Checks if a given string is a valid PayPal email address.
*
* @param {string} email - The email address to be checked.
* @returns {boolean} True if the email is a valid PayPal email address, false otherwise.
*/
function isPayPalEmailValid(email) {
// Regular expression pattern to validate PayPal email address
const paypalEmailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
// Check if the email matches the PayPal email pattern
return paypalEmailPattern.test(email);
}
// Usage Example
const email1 = "john.doe@example.com";
const email2 = "johndoe@paypal.com";
console.log(`Is ${email1} a valid PayPal email address? ${isPayPalEmailValid(email1)}`);
console.log(`Is ${email2} a valid PayPal email address? ${isPayPalEmailValid(email2)}`);