Difference between codePointAt and charCodeAt
问题 What is the difference between String.prototype.codePointAt() and String.prototype.charCodeAt() in JavaScript? 'A'.codePointAt(); // 65 'A'.charCodeAt(); // 65 回答1: From Mozilla: The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index (the UTF-16 code unit matches the Unicode code point for code points representable in a single UTF-16 code unit, but might also be the first code unit of a surrogate pair for code points not