Strings

Check the End

Check the End

For email domains, the position of the match matters. person@example.com should match @example.com, but person@example.com.test should not.

Your task: Write hasDomain. It should trim and lowercase the email, then return whether the cleaned email ends with the provided domain.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Check the End

For email domains, the position of the match matters. person@example.com should match @example.com, but person@example.com.test should not.

Your task: Write hasDomain. It should trim and lowercase the email, then return whether the cleaned email ends with the provided domain.

Free with a JS Exercises account

Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.

By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.

Console

Run code to see output.