JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id='a' style="width:100%;height:300px;"></textarea>

JavaScript

var textArea = document.getElementById('a');

for (var i = 0; i < 50; i++) {
    (function () {
        var iScoped = i;
        setTimeout(function () {
            textArea.value += 'Mensagem ' + iScoped + '\n';
            textArea.scrollTop = textArea.scrollHeight;
        }, 100 * i);
    })()
}