Svelte · Junior · Question 6 of 76
How do you output a JavaScript value in Svelte markup?
<script>
let name = "world";
</script>
<h1>Hello {name}!</h1>- ✓Correct answer: With curly braces:
{name} - 2With double braces:
{{ name }} - 3With
${name}
Explanation
Any JavaScript expression can go inside the braces. Text is escaped automatically, so it's safe from HTML injection.