Change Text Depending on Another Text Box?

For context, I am trying to create a pool of fake news stories to display at random on my website. I need a header to be randomly selected from a list, and then I need the body text to change to a paragraph that corresponds to the header.
I had played around with the idea of a random number generator and using the number generated to change what both text boxes display, but I am not very good at coding so I never figured it out. Is this possible?

Also, I dunno if this helps but this is the code I use for 1 text box:

$w.onReady(function () {

});

export function text1_viewportEnter(event) {
    const ArrayList = [
        'example text 1',
        'example text 2',
   
 ];

    const randomIndex = Math.floor(Math.random() * (ArrayList.length));
    $w('#text1').text = ArrayList[randomIndex]

}

This code should work just fine. Can you confirm if the event handler for text1_viewportEnter is declared like in the below screenshot?

image