Skip to content
Closed
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
13 changes: 13 additions & 0 deletions concepts/template-strings/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ When you are needing to have strings formatted on multiple lines:
`This is an example of using template
strings to accomplish multiple
lines`;

/* => This is an example of using template
strings to accomplish multiple
lines
*/
```
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`:

```javascript
"This is an example of using the newline escape sequence!\nWithout backticks"

/* => This is an example of using the newline escape sequence!
Without backticks
*/

With the available substitution capabilities, you can also introduce logic into the process to determine what the output string should be.
One way to handle the logic could be using the [ternary operator][ternary-operator].
Expand Down
4 changes: 3 additions & 1 deletion exercises/concept/custom-signs/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Implement the function `graduationFor(name, year)` which takes a name as a strin

```javascript
graduationFor('Hannah', 2022);
// => "Congratulations Hannah!\nClass of 2022"
/* => "Congratulations Hannah!
Class of 2022"
*/
```

## 4. Compute the cost of a sign
Expand Down
Loading