나는 실제로 간단한 문제가 있습니다. 다음 코드를 검토 할 때 의미하는 바를 이해하게 될 것입니다.toLowerCase 잘못된 하위 문자 "İ"
function isPalindrome(string){
string = string.toLowerCase();
var charArr = string.split('');
charArr.forEach(char => {
console.log(char);
})
console.log(charArr.length)
}
isPalindrome("İris");
출력
i
̇ <- what is this ?
r
i
s
5
당신이 보는대로 추가 문자를 추가. 나는이 문제를 해결할 수 없었다. 이 문제를 해결할 방법이 있습니까?
당신이 ['toLocaleLowerCase()'] 시도 (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ 적이 사용할 수 있습니다 문자열/toLocaleLowerCase)? –
@FedericoklezCulloca 와우 작동. toLowerCase와의 차이점은 무엇입니까? – vulkan
"İ"는 두 개의 유니 코드 문자로 구성되며 I 문자와 그 위에있는 점이 있습니다. '.toLocaleLowerCase()'는 그것을 하나의 문자로 인식합니다. – JJJ