String.prototype.charAt() vs String.prototype.charCodeAt()
String.prototype.charAt() and String.prototype.charCodeAt() are both JavaScript String APIs, and choosing between them is a common point of confusion. This page compares their syntax, parameters, return values, and typical use cases so you can pick the right one. String.prototype.charAt(): Returns the character at the specified index. Its syntax is str.charAt(index), and it returns a single character string. String.prototype.charCodeAt(): Returns the Unicode value of the character at the specified index. Its syntax is str.charCodeAt(index). Example of String.prototype.charAt(): "hello".charAt(1) // "e". Example of String.prototype.charCodeAt(): "A".charCodeAt(0) // 65. Read the full references for String.prototype.charAt() and String.prototype.charCodeAt() to see edge cases, time complexity, browser support, and the mistakes developers most often make with each. Other String APIs worth comparing: String.prototype.concat(), String.prototype.includes(), String.prototype.indexOf(), String.prototype.lastIndexOf(), String.prototype.match(), String.prototype.matchAll(). Both belong to the String category in the JS Reference documentation, which covers 35 entries in total. Try both in the JavaScript playground to see the behavioral difference live.