diff --git a/concepts/template-strings/introduction.md b/concepts/template-strings/introduction.md index 7e54dc9cf9..8ab158b98a 100644 --- a/concepts/template-strings/introduction.md +++ b/concepts/template-strings/introduction.md @@ -32,6 +32,19 @@ 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 single-line string (not using backticks), you can use the newline escape sequence `\n`: +```javascript +"Congratulations Hannah!\nClass of 2022" + +/* => Congratulations Hannah! + Class of 2022 +*/ ``` With the available substitution capabilities, you can also introduce logic into the process to determine what the output string should be.