Master text manipulation and string handling in JavaScript
Strings are sequences of characters used to represent text in JavaScript. They're fundamental for displaying messages, handling user input, and working with textual data.
const message = "This is a string"
'text'
Most common for simple strings
'Hello World!'
"text"
Interchangeable with single quotes
"JavaScript Strings"
`text`
Backticks for special features
`Template Literals`
The opening and closing quotes must match! Mixing quote types will cause errors.
'Hello World!'
"JavaScript Strings"
`Template Literals`
`Hello, ${name}!` → "Hello, Alice!"
`${10} + ${5} = ${10 + 5}` →
"10 + 5 = 15"
`Today is ${new Date().toLocaleDateString()}` →
"Today is 9/5/2025"
`Line 1 Line 2 Line 3`
"Line 1\nLine 2\nLine 3"
0
""
"123456"
${}
\n
\'
or \"
Number()
before math operations on user input