Is there a way to create a line break in TypeScript? I tried searching for a solution here, but couldn't find one.
I currently have a method that displays 10 numbers, and I would like to insert a line break between each number.
I attempted using \n
but it doesn't seem to work...
TS
export class AppComponent {
constructor() {}
public figure(): string {
let txt = '';
for (let i = 1; i < 11; i++) {
txt = txt + i + ' \n ';
}
return txt;
}
}
HTML
<h1>Exercise 9 </h1>
<p> {{ figure() }} </p>