<span style="color:#a30f00" class="tadv-color">charAt()</span> that returns the character at a index from the string.
<span style="color:#a33100" class="tadv-color">charAt(1) </span>will return a character from string at index location 1.
<!DOCTYPE html> <html> <head> <title>JS: charAt() Method</title> <meta charset="utf-8"> </head> <body> <script> var country = "HOLLAND"; console.log(country.charAt(4)); //output = 'A' </script> </body> </html>
In the above script, we want to know which character is located at index location 4. The
<span style="color:#a30500" class="tadv-color">charAt()</span> method will return ‘A’ from the string.