Basic JavaScript (35/111) | Use Bracket Notation to Find the Nth to Last Character in a String

Опубликовано: 14 Август 2020
на канале: Stral Tech
290
4

Basic JavaScript (35/111) | Use Bracket Notation to Find the Nth to Last Character in a String | freeCodeCamp

Full playlist 👉    • Basic JavaScript (1/111) | Comment Yo...  

You can use the same principle we just used to retrieve the last character in a string to retrieve the Nth-to-last character.

For example, you can get the value of the third-to-last letter of the var firstName = "Charles" string by using firstName[firstName.length - 3]

Example:
var firstName = "Charles";
var thirdToLastLetter = firstName[firstName.length - 3]; // thirdToLastLetter is "l"


Смотрите видео Basic JavaScript (35/111) | Use Bracket Notation to Find the Nth to Last Character in a String онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Stral Tech 14 Август 2020. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 290 раз и оно понравилось 4 посетителям.