diff --git a/concepts/template-strings/introduction.md b/concepts/template-strings/introduction.md index 7e54dc9cf9..ed6ba23b6a 100644 --- a/concepts/template-strings/introduction.md +++ b/concepts/template-strings/introduction.md @@ -32,8 +32,22 @@ 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]. This gives the same conditional `if/else` functionality in a slightly different format. @@ -45,7 +59,7 @@ const grade = 95; `You have ${grade > 90 ? 'passed' : 'failed'} the exam.`; // => You have passed the exam. -``` +```` [string-reference]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String [type-conversion-concept]: /tracks/javascript/concepts/type-conversion diff --git a/exercises/concept/custom-signs/.docs/instructions.md b/exercises/concept/custom-signs/.docs/instructions.md index 3a8a659d6f..e4ccb0ba46 100644 --- a/exercises/concept/custom-signs/.docs/instructions.md +++ b/exercises/concept/custom-signs/.docs/instructions.md @@ -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