Skip to content

Commit ed26392

Browse files
committed
document string coercion and handling of nullish values
1 parent 3f7e5b0 commit ed26392

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

documentation/docs/03-template-syntax/01-basic-markup.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ A JavaScript expression can be included as text by surrounding it with curly bra
154154
{expression}
155155
```
156156

157+
Expressions that are `null` or `undefined` will be omitted; all others are [coerced to strings](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion).
158+
157159
Curly braces can be included in a Svelte template by using their [HTML entity](https://developer.mozilla.org/docs/Glossary/Entity) strings: `{`, `{`, or `{` for `{` and `}`, `}`, or `}` for `}`.
158160

159161
If you're using a regular expression (`RegExp`) [literal notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#literal_notation_and_constructor), you'll need to wrap it in parentheses.

0 commit comments

Comments
 (0)