0
자바 스크립트 UI가 끝점과 통화 중입니다. 엔드 포인트는 JSON 오브젝트의 배열로 패스 프레이즈 챌린지를 리턴합니다. 각 객체는 암호문과 문자 코드 포인트 값에 문자 색인을 가지고있었습니다.문자 변환 - fromCharCode 문제
[{"index":3,"nValue":101},{"index":5,"nValue":114},{"index":6}]
코드 포인트를 문자로 다시 변환하는 데 어려움이 있습니다. RangeError 예외가 발생합니다. 왜 숫자를 분석하여 fromCharCode 메서드에 전달할 수 없는지 잘 모르겠습니다.
for(var i = 0;i<result.length;i++){
console.log(typeof result[i].nValue); //prints string
console.log('returnVal=*'+result[i].nValue+'*'); //prints *e*
var intChar = parseInt(result[i].nValue);
console.log(typeof intChar); //prints number
console.log('intChar=*'+intChar+'*'); //prints *NaN*
console.log('converted='+String.fromCharCode(result[i].nValue)); //empty string
console.log('converted='+String.fromCodePoint(result[i].nValue)); //trows range exception
}