Use Bracket Notation to Find the NthtoLast Character in a String, freeCodeCamp Basic Javascript

Lesson Summary

In this challenge we learn how to target a certain character at the end of our string by using .length minus the number of spaces back you want to target for example take this myName variable, "var myName = "Jose" If I wanted to target the "s" which is the second to last letters I would simply do this myName[myName.length - 2] and that would get the "s".

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required