<style>
.red {
color: red;
}
</style>
<p class="hello">Lorem ipsum dolor sit amet, consectetur</p>
<p class="hello">Sapiente in delectus dolorem reiciendis ditii</p>
<p class="hello">Quis dolore autem voluptatibus repellat</p>
<script>
function next(len) {
var i = -1;
return function () {
i++;
return i == len ? -1: i;
};
}
var allP = document.querySelectorAll('p.hello'),
pos = next(allP.length),
current,
timer = setInterval(function () {
current = pos();
if (current == -1) {
clearInterval(timer);
} else {
allP[current].className += ' red';
}
}, 2000);
</script>