'문자'.codePointAt() : 문자를 아스키코드로 변환
var str = "S";
var ascii = str.codePointAt();
console.log(ascii); // 83
String.fromCodePoint('숫자') : 아스키코드를 문자로 변환
var ascii = 83;
var str = String.fromCodePoint(ascii);
console.log(str); // S
암기법 : fromCodePointAt
'JavaScript' 카테고리의 다른 글
[Javascript] 배열의 최대값, 최소값 구하기 / Math.max(), Math.min() (0) | 2023.08.02 |
---|---|
[Javascript] 문자열 곱하기 / '문자열'.repeat(횟수) (0) | 2023.08.02 |
[Javascript] 거듭제곱, 제곱근 구하기 / Math.pow(), Math.sqrt() (0) | 2023.08.02 |
[Javascript] 문자열 치환하기 / replace(), 정규식 (0) | 2023.08.02 |
[Javascript] 배열 요소 추가,삭제 메서드 / push(), pop(), shift(), unshift() (0) | 2023.08.02 |