JS: String.fromCodePoint (ID to Char)

By Xah Lee. Date: . Last updated: .

(new in ECMAScript 2015)

String.fromCodePoint(char_id_1, char_id_2, etc)

create a string from Code Point (Char ID).

/* create string from unicode codepoints */

console.assert(
 String.fromCodePoint(97, 98, 99) === "abc",
);

console.assert(
 String.fromCodePoint(127828, 127829, 127789) ===
  "🍔🍕🌭",
);

// character: 🍔 (codepoint 127828, #o371524, #x1f354)
// character: 🍕 (codepoint 127829, #o371525, #x1f355)
// character: 🌭 (codepoint 127789, #o371455, #x1f32d)

To easily find a character's codepoint, see Unicode Search 🔍