About 104,000 results
Open links in new tab
  1. JavaScript String charAt () Method - W3Schools

    Description The charAt() method returns the character at a specified index (position) in a string. The index of the first character is 0, the second 1, ...

  2. javascript - How to get first character of string? - Stack Overflow

    The charAt () method allows you to specify the position of the character you want. What you were trying to do is get the character at the position of an array "x", which is not defined as X is not an array.

  3. JavaScript - How to Find the First and Last Character of a String?

    Aug 5, 2025 · The charAt (), Bracket Notation, and slice () methods are the most simple and commonly used for finding the first and last characters of a string. Use the method that fits your specific use …

  4. How to Get the First Character of a String - W3docs

    Read this JavaScript tutorial and learn several string methods that are used to retrieve the first character of a string. Choose the best one for you.

  5. How to Get the First Character of a String in JavaScript

    This guide will teach you the two standard, modern methods for accessing the first character of a string: the simple and common bracket notation (str[0]) and the newer, more flexible at() method.

  6. String.prototype.charAt () - JavaScript | MDN

    Jul 10, 2025 · Characters in a string are indexed from left to right. The index of the first character is 0, and the index of the last character in a string called str is str.length - 1.

  7. How to Get the First Character of a String in JavaScript: Fixing IE7 ...

    Nov 21, 2025 · JavaScript provides two primary ways to retrieve the first character of a string: bracket notation and the charAt() method. Let’s explore each in detail. Bracket notation is the most concise …

  8. How to get First Character in String in JavaScript

    How to get First Character in String in JavaScript ? To get the first character of a string in JavaScript, you can use array-like indexing or the charAt() method. In this example, We create a string variable …

  9. 5 Ways to Get the First Character of a String in JavaScript

    Jun 22, 2022 · Learn multiple ways to easily get the first character of a string in JavaScript.

  10. How to Get First Character From a String in JavaScript

    Feb 2, 2024 · This article will guide you in using built-in JavaScript methods to get the first character of a string. Four methods, slice, charAt, substring, and substr, are available in JavaScript, which will …