freecoding.school100% FREE · NO SIGNUP
Script SpringsISSUE #11 of 29

strings · single · double · backtick

SparkyVSNaN the Trickster
Sparky saysStrings can use single quotes, double quotes, or backticks — backticks add interpolation.

All three create strings. Backticks (template literals) are the modern default: they allow ${expr} interpolation and multi-line text without escapes. Strings are immutable — methods return new strings rather than changing the original. Access characters by index or .length.

Power-ups you unlock

NaN the Trickster attacks — common mistakes

Boss battleBuild a greeting with a template literal that interpolates a name variable.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>const name='drewless'; const msg=`hello, ${name} — length ${name.length}`;
document.getElementById('o').textContent = msg;</script></body></html>
▶ Open the interactive comic issue
‹ Bigint · Arbitrary PrecisionTemplate Literals · Interpolation ›