String.charCodeAt() 會回傳指定索引處字元的 Unicode 編碼。
var str = 'A'; str.charCodeAt(0);
索引從 0 開始,若超出範圍會回傳 NaN。
這個方法常用於字元驗證、編碼處理與低階字串分析。