Strings

Slice From the End

Slice From the End

slice can read from the end of a string with a negative start index. That is useful when the part you need has a known length.

Your task: Create extension from the provided filename. It should contain the final two characters. Log the extension.

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.

Slice From the End

slice can read from the end of a string with a negative start index. That is useful when the part you need has a known length.

Your task: Create extension from the provided filename. It should contain the final two characters. Log the extension.

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.