JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test">Information test</div>
JavaScript
var test = document.getElementsByClassName('test')[0].innerHTML;
var testLength = test.length;
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
console.log(getRandomInt(1, testLength));
console.log(test.charAt(0));