Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

595 B

title
title
Use Bracket Notation to Find the Nth-to-Last Character in a String

Use Bracket Notation to Find the Nth-to-Last Character in a String


Hints

Hint 1

Remember that the position of any character, is the length of the string, minus one, minus the number of characters after it. For example, if you are trying to find the third-to-last character of the following string:

var str = "Programming";
var secondToLastChar = str[str.length - 2]; // This is 'i'

As you can see, there is one extra character after 'n' (and that is 'g').