Three Types of Quotes

JS has three ways to create a string, and one of them is a superpower.

1. Single and Double

There is almost no difference: 'Hello' and "Hello". Pick one style for the whole project.

2. Backticks (Template Literals)

Used to insert expressions directly into text via ${...}.

let name = "Ivan";
alert(`Hello, ${name}!`); // Hello, Ivan!
alert(`Sum: ${2 + 2}`); // Sum: 4

They also let you write multiline text without \n.

3. Special Characters and Unicode

  • \n — newline.
  • \uXXXX — Unicode character (e.g., \u1F600 is 😀).
  • str.length — a property (not a method!) that returns string length.
Tip

If you need to insert a backtick itself inside a template string, use escaping: \ `.

Caution

Don't confuse the length property with a method: str.length() will throw an error!