Work With Strings in JavaScript I
JavaScript·1 min read·Jan 1, 2026
In JavaScript, a string literal, string of characters, or simply string, is a primitive data type that represents a sequence of individual characters, such as letters, digits, symbols, or spaces, enclosed in single quotes '', double quotes "", or backticks ``.
It is used for storing textual information, text manipulation, and representing data in a human-readable format.
Access individual characters
To access the individual character of a string, you can use the square brackets syntax []:
string[index]Where:
stringis a string of characters.indexis the index (or position) of the character you want to access within thestring. It can either be a user-defined number or a variable containing a computed number.
Notes:
- The index of the first character in a string is
0.- When accessing an "out of bounds" index, the expression will result in
undefined.
Example
Unlock the program 🚀
Pay once, own it forever.
€79
30-day money-back guarantee
- 13 modules
- 113 lessons with full-code examples
- 29 projects with commented solutions
- All future lesson and project updates
- Lifetime access
By submitting this form, you agree to the Terms & Conditions and Privacy Policy.