Foundations

Length and Indexing

Length and Indexing

String indexes start at 0, so the last character is one less than the string length. That pattern works even when the word changes.

Your task: Create lastLetter from the provided course code by using its length. Log the last letter.

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.

Length and Indexing

String indexes start at 0, so the last character is one less than the string length. That pattern works even when the word changes.

Your task: Create lastLetter from the provided course code by using its length. Log the last letter.

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.