To create a line break within a string in TypeScript (or JavaScript), you can use the escape sequence "\n". This will create a new line wherever it appears within the string.
index.ts99 chars3 lines
Alternatively, you can use template literals, which allow for multi-line strings without the need for escape sequences. To use template literals, surround the string with backticks (`) and use ${} to insert variables or expressions within the string.
index.ts180 chars6 lines
Both of these methods will output:
index.ts49 chars3 lines
gistlibby LogSnag