Purus Education
JA
Lesson 03

Strings

Lesson 03 — Strings

日本語

Syntax

Write [expr] inside a string to embed any expression — this is string interpolation, like ${} in JavaScript:

const name be //;Alice;//
const age be 30
const msg be //;Hello, [name]! You are [age] years old.;//

Compiles to:

const msg = `Hello, ${name}! You are ${age} years old.`;

To write a literal [ or ], escape it: \[ \].

Task

Use interpolation with [name] so that greeting becomes Hello, World!.

Check

npm test 03

Learn more

Loading editor...
Press Ctrl+Enter to run