Files
freeCodeCamp/curriculum/challenges/korean/02-javascript-algorithms-and-data-structures/basic-javascript/use-bracket-notation-to-find-the-last-character-in-a-string.md
2024-05-13 09:45:13 -07:00

1.6 KiB

id, title, challengeType, videoUrl, forumTopicId, dashedName
id title challengeType videoUrl forumTopicId dashedName
bd7123c9c451eddfaeb5bdef 브라켓 표기법을 사용해서 문자열의 마지막 문자를 찾기 1 https://scrimba.com/c/cBZQGcv 18342 use-bracket-notation-to-find-the-last-character-in-a-string

--description--

문자열의 마지막 문자를 얻기 위해서는, 문자열의 길이에서 하나를 빼서 얻을 수 있습니다.

예를 들어 const firstName = "Ada"의 경우에는 firstName[firstName.length - 1]를 사용해서 문자열의 마지막 문자의 값을 얻을 수 있습니다.

예:

const firstName = "Ada";
const lastLetter = firstName[firstName.length - 1];

lastLetter의 값은 문자열 a가 될 것입니다.

--instructions--

브라켓 표기법을 사용해서 lastName 변수의 마지막 문자를 찾으세요.

힌트: 막혔을 때는 위의 예시를 다시 봐주세요.

--hints--

lastLetterOfLastName 문자 e가 되어야 합니다.

assert(lastLetterOfLastName === 'e');

당신은 .length를 사용해서, 마지막 문자를 얻어야 합니다.

assert(__helpers.removeJSComments(code).match(/\.length/g).length > 0);

--seed--

--after-user-code--

(function(v){return v;})(lastLetterOfLastName);

--seed-contents--

// Setup
const lastName = "Lovelace";

// Only change code below this line
const lastLetterOfLastName = lastName; // Change this line

--solutions--

const lastName = "Lovelace";
const lastLetterOfLastName = lastName[lastName.length - 1];