Multiple stance of typewriter effect on same page

So something like this:

const pauseBetweenWords = 1000; //ms
const sentences = [
    'Word1, Word2, Word3',
    'Word4, Word5, Word6',
    'Word7, Word8, Word9'
];
const words = sentences.map(e => e.split(' '));
let restWords = [...words];
$w.onReady(() => {
   const elements = [$w('#text1'), $w('#text2'), $w('#text3')];
            setInterval(showText, pauseBetweenWords);
            function showText() {
                elements.forEach((e, i) => {
                    const wordInx = Math.floor(Math.random() * restWords[i].length);
                    let randomWord = restWords[i][wordInx];
                    e.text = randomWord;
                    restWords[i] = words[i].filter(w => w !== randomWord);
                });
            }
})