Skip to content

[docs] simplify template literals to string primitives #6806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let count = 0;

$: if (count >= 10) {
alert(`count is dangerously high!`);
alert('count is dangerously high!');
count = 9;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ title: Statements
We're not limited to declaring reactive *values* — we can also run arbitrary *statements* reactively. For example, we can log the value of `count` whenever it changes:

```js
$: console.log(`the count is ${count}`);
$: console.log('the count is ' + count);
```

You can easily group statements together with a block:

```js
$: {
console.log(`the count is ${count}`);
alert(`I SAID THE COUNT IS ${count}`);
console.log('the count is ' + count);
alert('I SAID THE COUNT IS ' + count);
}
```

You can even put the `$:` in front of things like `if` blocks:

```js
$: if (count >= 10) {
alert(`count is dangerously high!`);
alert('count is dangerously high!');
count = 9;
}
```