JavaScript: String.prototype.codePointAt

By Xah Lee. Date: . Last updated: .

New in JS2015.

str.codePointAt(pos)
Return a integer that's the codepoint of character at position pos of str.

[see Character, Code Unit, Codepoint]

console.log("abc".codePointAt(0) === 97); // true
console.log("😂".codePointAt(0) === 128514); // true

/* [
😂
name: FACE WITH TEARS OF JOY
codepoint 128514
codepoint hexadecimal 1f602
] */

See also: Unicode Search 😄

BUY
ΣJS
JavaScript in Depth

JS Obj Reference

String

prototype