Strings

Split a Name

Split a Name

When text has a reliable separator, you can split it into pieces and read the characters you need from each piece.

Your task: Write getInitials. It receives a two-word name and should return the two uppercase initials.

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.

Split a Name

When text has a reliable separator, you can split it into pieces and read the characters you need from each piece.

Your task: Write getInitials. It receives a two-word name and should return the two uppercase initials.

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.