Strings are UTF-16 text. Template literals (backticks) support interpolation and multiline text.
Template literals
const name = 'Ada';
const msg = `Hello, ${name}!`;
console.log(msg);
Useful methods
includes, startsWith, trim, split, slice—prefer these over regex for simple checks.
Important interview questions and answers
- Q: Backticks vs quotes?
A: Backticks allow ${} interpolation and multiline. - Q: Immutable strings?
A: Primitives are immutable—methods return new strings.
Self-check
- How embed a variable in a string?
- What does trim() do?
Tip: Re-run the playground code for strings-template-literals and tweak one line before the MCQs.
Interview prep
- Backticks?
Enable interpolation and multiline strings.