string.codePointAt

codePointAt() method๋Š” Unicode code point์Œ์ˆ˜๊ฐ€ ์•„๋‹Œ ์ •์ˆ˜๋ฅผ ๋ฆฌํ„ดํ•œ๋‹ค.

const icons = 'โ˜ƒโ˜…โ™ฒ';

console.log(icons.codePointAt(1)); // 9733

Syntax

str.codePointAt(pos)

Parameters

pos

code point ๊ฐ’์œผ๋กœ ๋ฐ˜ํ™˜ํ•  String ์š”์†Œ์˜ ์œ„์น˜

Return value

์ฃผ์–ด์ง„ index์˜ code point ๊ฐ’์˜ ๋ฌธ์ž๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆซ์ž,

index์œ„์น˜์— element๊ฐ€ ์—†์„ ๊ฒฝ์šฐ undefined

Description

index์—์„œ surrogate pair์ด ์‹œ์ž‘๋˜์ง€ ์•Š์œผ๋ฉด index ์œ„์น˜์— ์žˆ๋Š” code unit์„ return ํ•œ๋‹ค.

Examples

Using codePointAt()

Polyfill

Last updated

Was this helpful?