File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
concepts/template-strings Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff 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
3333strings to accomplish multiple
3434lines` ;
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!\n Without backticks"
45+
46+ /* => This is an example of using the newline escape sequence!
47+ Without backticks
48+ */
3649
3750With the available substitution capabilities, you can also introduce logic into the process to determine what the output string should be.
3851One way to handle the logic could be using the [ternary operator][ternary- operator].
You can’t perform that action at this time.
0 commit comments