JSFiddle - React, Tailwind, and code Playground

by Zoxon

HTML

<div class="aphorisms">
    <h3>Афоризмы</h3>
    <p id="aphorism-text" class="text"></p>
</div>

JavaScript

var array = ['строка 1', 'строка 2', 'строка 3','строка 4', 'строка 5', 'строка 6'];
var random = 0;


var intervalId = window.setInterval(editAphorism(), '1000');
editAphorism();


function editAphorism(){
    var random = getRandomInt(0, array.length-1);
    document.getElementById('aphorism-text').innerHTML = array[random];
}


function getRandomInt(min, max)
{
  return Math.floor(Math.random() * (max - min + 1)) + min;
}