charAt() 함수는 문자열에서 특정 인덱스에 위치하는 유니코드 단일문자를 반환한다.
사실 이 함수를 사용하지 않고 String[index]로도 사용할 수있다.
const sentence = 'The quick brown fox jumps over the lazy dog.';
const index = 4;
console.log(`The character at index ${index} is ${sentence.charAt(index)}`);
// Expected output: "The character at index 4 is q"
'NOTE' 카테고리의 다른 글
리액트 오류: React DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node (0) | 2023.08.05 |
---|---|
string 대문자, 소문자 체크하기 (0) | 2023.05.05 |
배열의 두 요소 순서를 변경할 때 (0) | 2023.05.05 |
HTTP, HTTPS의 차이 (0) | 2023.04.20 |
[용어] 인스턴스와 프로퍼티, 메소드 (0) | 2023.04.20 |