🧐 What is a String?

A string is a sequence of characters enclosed in:

Double quotes"Hello, World!"

Single quotes'JavaScript is fun!'

Backticks ( ) for Template LiteralsI am learning JavaScript!

Strings are immutable, meaning once created, they cannot be changed. However, you can manipulate them using various methods.


🚀 String Methods You Must Know!

1. Accessing Characters in a String

You can access individual characters using indexing ([]) or .at().

let str = "JavaScript";
console.log(str[0]);     // Output: J
console.log(str.at(-1)); // Output: t (last character)


2. .length - Get String Length

Returns the number of characters in a string.

let text = "Hello, World!";
console.log(text.length);  // Output: 13


3. .charAt(index) - Get Character at Index