π Prefer String#codePointAt(β¦) over String#charCodeAt(β¦) and String.fromCodePoint(β¦) over String.fromCharCode(β¦).
πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π‘ This rule is manually fixable by editor suggestions.
Unicode is better supported in String#codePointAt() and String.fromCodePoint().
// β
const unicorn = 'π¦'.charCodeAt(0).toString(16);
// β
const unicorn = 'π¦'.codePointAt(0).toString(16);// β
const unicorn = String.fromCharCode(0x1f984);
// β
const unicorn = String.fromCodePoint(0x1f984);