How to process each letter of text using JavaScript ? Last Updated : 16 Aug, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Given a string and the task is to process it character by character. JavaScript String toUpperCase() Method: This method converts a string to uppercase letters. Syntax: string.toUpperCase()Parameters: This method accepts single parameter str which is required. It specifies the string to be searched.Return Value: It returns a string denoting the value of a string converted to uppercase. JavaScript String charAt() Method: This method returns the character at the passed index in a string. The index of characters starts from 0.Syntax: string.charAt(index)Parameters: This method accepts single parameter index which is required. It specifies the integer representing the index of the character to return.Return Value: It returns a string, denoting the character at the passed index, or an empty string if the index number is invalid. Example 1: This example processes the string letter by letter using for loop and converts each letter to uppercase separately. html <!DOCTYPE HTML> <html> <head> <title> How to process each character of text </title> </head> <body style = "text-align:center;"> <h1 style = "color:green;" > GeeksForGeeks </h1> <p id = "GFG_UP" style = "font-size: 15px; font-weight: bold;"> </p> <button onclick = "gfg_Run()"> check </button> <p id = "GFG_DOWN" style = "color:green; font-size: 20px; font-weight: bold;"> </p> <script> var el_up = document.getElementById("GFG_UP"); var el_down = document.getElementById("GFG_DOWN"); var str = "This is String"; el_up.innerHTML = "String = '"+str + "'"; function gfg_Run() { var str_Upper = ""; for (var i = 0; i < str.length; i++) { str_Upper += str.charAt(i).toUpperCase(); } el_down.innerHTML = str_Upper; } </script> </body> </html> Output: Before clicking on the button: After clicking on the button: Example 2: This example processes the string letter by letter using for in loop and alerts each letter separately. html <!DOCTYPE HTML> <html> <head> <title> How to process each letter of text </title> </head> <body style = "text-align:center;"> <h1 style = "color:green;" > GeeksForGeeks </h1> <p id = "GFG_UP" style = "font-size: 15px; font-weight: bold;"> </p> <button onclick = "gfg_Run()"> check </button> <script> var el_up = document.getElementById("GFG_UP"); var str = "str"; el_up.innerHTML = "String = '" + str + "'"; function gfg_Run() { for (var i in str) { alert(" character = "+str.charAt(i)); } } </script> </body> </html> Output: Before clicking on the button: After clicking on the button: Comment More infoAdvertise with us Next Article How to replace lowercase letters with an other character in JavaScript ? P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies Similar Reads How to Detect Keypress using JavaScript ? In this article, keyboard detection is performed using HTML and CSS. HTML stands for "Hypertext Markup Language". HTML language helps the developer to create and design web page elements like links, sections, paragraphs, headings, and blockquotes for web applications. CSS stands for "Cascading Style 2 min read JavaScript - How to Make First Letter of a String Uppercase? Here are the different approaches to make the first letter of a string uppercase in JavaScript.1. Using charAt() with slice() Method (Most Common)The combination of charAt() and slice() is the simplest and widely used way to capitalize the first letter of a string.JavaScriptconst s1 = "javaScript"; 2 min read How to Get Character of Specific Position using JavaScript ? Get the Character of a Specific Position Using JavaScript We have different approaches, In this article we are going to learn how to Get the Character of a Specific Position using JavaScript Below are the methods to get the character at a specific position using JavaScript: Table of Content Method 1 4 min read How to replace lowercase letters with an other character in JavaScript ? Given a string and the task is to replace all lowercase letters from a string with the other characters in JavaScript. There are some approaches to replace the character that are described below: JavaScript replace() Method: This method searches a string for a defined value, or a regular expression, 2 min read How to check the given string is palindrome using JavaScript ? A palindrome is a word, sentence, or even number that reads the same from the back and from the front. Therefore if we take the input, reverse the string and check if the reversed string and the original string are equal, it means the string is a palindrome, otherwise, it is not. Approach: When the 3 min read How to replace all dots in a string using JavaScript ? We will replace all dots in a string using JavaScript. There are multiple approaches to manipulating a string in JavaScript. Table of Content Using JavaScript replace() MethodUsing JavaScript Split() and Join() Method Using JavaSccript reduce() Method and spread operatorUsing JavaScript replaceAll() 4 min read Like