My current goal involves executing the following code with no success:
var arr = ['one', 'two','three']
const mydiv = document.createElement('textarea')
mydiv.innerText = arr.join('\r\n')
document.body.append(mydiv)
In researching solutions, some suggest using \r
(without explaining why), but this does not resolve the issue.
Interestingly, when I replace the textarea
element with a div
, the use of \n
works as expected.