Skip to content

Commit d8bc02a

Browse files
authored
Update introduction.md
1 parent a5bd153 commit d8bc02a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

concepts/template-strings/introduction.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,20 @@ When you are needing to have strings formatted on multiple lines:
3232
`This is an example of using template
3333
strings to accomplish multiple
3434
lines`;
35+
36+
/* => This is an example of using template
37+
strings to accomplish multiple
38+
lines
39+
*/
3540
```
41+
If you want to represent a newline inside a single-line string (not using backticks), you can use the newline escape sequence `\n`:
42+
43+
```javascript
44+
"This is an example of using the newline escape sequence!\nWithout backticks"
45+
46+
/* => This is an example of using the newline escape sequence!
47+
Without backticks
48+
*/
3649

3750
With the available substitution capabilities, you can also introduce logic into the process to determine what the output string should be.
3851
One way to handle the logic could be using the [ternary operator][ternary-operator].

0 commit comments

Comments
 (0)