You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: concepts/template-strings/introduction.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,12 +41,13 @@ lines`;
41
41
42
42
If you want to represent a newline inside a regular string instead of using a template string (ie. not using backticks), you can use the newline escape sequence `\n`:
43
43
44
-
````javascript
45
-
"This is an example of using the newline escape sequence!\nWithout backticks"
44
+
```javascript
45
+
'This is an example of using the newline escape sequence!\nWithout backticks';
46
46
47
47
/* => This is an example of using the newline escape sequence!
48
48
Without backticks
49
49
*/
50
+
```
50
51
51
52
With the available substitution capabilities, you can also introduce logic into the process to determine what the output string should be.
52
53
One way to handle the logic could be using the [ternary operator][ternary-operator].
@@ -59,7 +60,7 @@ const grade = 95;
59
60
60
61
`You have ${grade >90?'passed':'failed'} the exam.`;
0 commit comments