charAt

요약
특정 인덱스에 위치하는 유니코드 단일문자 반환 / 없다면 빈문자열 "" 반환
Tags
인덱싱
const sentence = 'The quick brown fox jumps over the lazy dog.'; sentence.charAt(4); // q
 
var anyString = 'Brave new world'; console.log("The character at index 0 is '" + anyString.charAt() + "'"); // No index was provided, used 0 as default console.log("The character at index 0 is '" + anyString.charAt(0) + "'"); console.log("The character at index 1 is '" + anyString.charAt(1) + "'"); console.log("The character at index 2 is '" + anyString.charAt(2) + "'"); console.log("The character at index 3 is '" + anyString.charAt(3) + "'"); console.log("The character at index 4 is '" + anyString.charAt(4) + "'"); console.log("The character at index 999 is '" + anyString.charAt(999) + "'"); // The character at index 0 is 'B' // The character at index 1 is 'r' // The character at index 2 is 'a' // The character at index 3 is 'v' // The character at index 4 is 'e' // The character at index 999 is ''