JavaScript theorytheory 0/50 · 0%
Data · easy

7. Strings and template literals

Immutability, methods and interpolation.

Strings are immutable: every method returns a new string. Template literals interpolate expressions and span lines.

const addr = "0xAbC123";
const short = `${addr.slice(0, 6)}…${addr.slice(-4)}`;
addr.toLowerCase();
addr.startsWith("0x");

Addresses are case-insensitive but the mixed case is an EIP-55 checksum — compare them lowercased, display them checksummed.

Check your understanding

  1. 1. What does `toLowerCase()` do to the original string?

  2. 2. What is the mixed case in an address?

  3. 3. Which syntax interpolates values?