이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
A cleaner way to build strings
- Wrap a string in backticks
`and you can drop values straight in with${...}. - This is a template literal — much tidier than joining with lots of
+.

English
let name = "Ada";
let age = 15;
console.log(`${name} is ${age}`); // → Ada is 15
English
Any expression fits inside ${ }
- Whatever you write inside
${...}is worked out first, then dropped into the string.
English
let a = 3;
let b = 4;
console.log(`${a} + ${b} = ${a + b}`); // → 3 + 4 = 7
English
Same string, two ways
+and a template literal can build exactly the same text.- In backticks, spaces and punctuation stay where you type them, so a missing space is easy to see.
English
let item = "pen";
let price = 3;
console.log("A " + item + " costs " + price + " yuan."); // → A pen costs 3 yuan.
console.log(`A ${item} costs ${price} yuan.`); // → A pen costs 3 yuan.
English
Watch out
- Backticks
`are not the same as quotes'or".${...}only works inside backticks. - Bonus: a backtick string can span several lines — handy for longer messages.
English
Common mistakes
- Template literals use backticks and
${...}:`Hi ${name}`, not quotes. - Inside
${...}you can put any expression.
English
Now you try
- Use backticks and
${...}. - Press Check answer to test it.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
let name = "Sam". Use a template literal (backticks) to log Hello, Sam!.
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
a is 3 및 b is 4. Use a template literal to log 3 + 4 = 7 (put a + b inside ${ }).
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Use a template literal to log Total: 10, working out the 10 as 5 * 2 inside ${ }.
출력을 보려면 '실행'을 클릭하세요.