JSFiddle - React, Tailwind, and code Playground
HTML
<div id="h">
</div>
<div id="words">
</div>
JavaScript
var a = "Hello world my name is Mohammed and i love JavaScript and this is just random text to test in it I hope you are having a good time Love you body"
var h = document.getElementById("h")
var words = document.getElementById("words")
h.innerHTML="The length of the string is " + a.length
var Array_of_a = a.match(/.{1,50}/g);
for (var i = 0; i < Array_of_a.length; i++) {
var text = document.createTextNode(Array_of_a[i]);
var div = document.createElement("div");
div.appendChild(text);
div.className = "MyClass"
div.id = Math.random()
document.body.insertBefore(div, words);
}