SELECT AN INPUT

String
String + /n
String + HTML
Array of Strings + .join('\n')

SELECT A METHOD

Supported in effectively all browsers (since IE6+, Firefox 2+, Chrome 1+ etc)

Tends to have better performance because the text is not parsed as HTML but plain text. Moreover, using textContent can prevent XSS attacks.

Represents the "rendered" text content of a node and its descendants.

Potential security risk whenever you use innerHTML to set strings over which you have no control.

SELECT AN OUTPUT

Method:

CSS white-space Settings: