Essential JavaScript String Methods for Text Manipulation
Locating Substrings
To find the position of a specific character or sequence within a string, use indexOf(). This method returns the index of the first occurrence or -1 if the value is not found.
const message = "Learn, build, and share";
// Finding the first occurrence of 'b'
const firstB = message.indexOf("b"); // returns ...
Posted on Tue, 25 Aug 2026 16:05:00 +0000 by feddie1984
Comprehensive Guide to JavaScript String Methods
Character Access
The charAt() method retrieves the character at a specific index position. Modern JavaScript also supports bracket notation for the same purpose.
const text = 'developer';
console.log(text.charAt(0)); // 'd'
console.log(text[0]); // 'd' (equivalent)
// charCodeAt() returns the Unicode code point
console.log(text.charCod ...
Posted on Sun, 14 Jun 2026 17:52:59 +0000 by jpraj