Lesson content
Read, practise, then check your understanding
Strings are immutable UTF-16 sequences. Methods such as slice, includes, startsWith, replace, split, trim, and case conversion return new values.
Templates
const user = "Mira";
const completed = 7;
const message = `${user} completed ${completed} chapters.`;
Template literals support expressions, multiline text, and tagged processing. Length and indexing count UTF-16 code units, so some characters occupy two positions; for...of iterates code points more appropriately. Locale-sensitive comparison and formatting use Intl. Never insert untrusted strings through HTML parsing merely because a template makes it convenient—use DOM text APIs or correct contextual escaping.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.