From 5d4a2e65fd811e9e4a329699fb00e7ef17b3cc68 Mon Sep 17 00:00:00 2001 From: Dominik Leicht Date: Mon, 4 Oct 2021 10:33:44 +0200 Subject: [PATCH] A note about template literals Coming from python JS template literal syntax was new to me. This part of the otherwise fantastic tutorial threw me off, because I did not immediately notice the backticks. Like: "Oh, that's an interesting concept. But it doesn't work. Bummer." Took me a while to figure. --- .../tutorial/02-reactivity/03-reactive-statements/text.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/site/content/tutorial/02-reactivity/03-reactive-statements/text.md b/site/content/tutorial/02-reactivity/03-reactive-statements/text.md index 1b0e90b7d5..d2c79714b4 100644 --- a/site/content/tutorial/02-reactivity/03-reactive-statements/text.md +++ b/site/content/tutorial/02-reactivity/03-reactive-statements/text.md @@ -8,6 +8,8 @@ We're not limited to declaring reactive *values* — we can also run arbitrary * $: console.log(`the count is ${count}`); ``` +> Did you notice we are using [template literal syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals "MDN Web Docs") here? `the count is ${count}` is enclosed by `` ` `` backticks, **not** `'` quotes. This enables us to substitute it with reactive declarations, `${count}` for example. + You can easily group statements together with a block: ```js @@ -24,4 +26,4 @@ $: if (count >= 10) { alert(`count is dangerously high!`); count = 9; } -``` \ No newline at end of file +```