How Can I Make a List from Comment Input?

I built a random generator that outputs to a text element. What I now need to do is populate my initial list. I’d like to use a comment input for this. How can I make the list one item per line?

I have another way I think I can do this, but it would be easier for the user if they could just put a list (one item per line) into a field and click enter.

Any ideas?

Here’s what I have so far:

var allTeams = [
 'team01',
 'team02',
 'team03',
 'team04'
];

$w.onReady(function () {
});

export function button3_click(event) {
    allTeams = $w("#input").value;
    const randomIndex = Math.floor(Math.random() *
    (allTeams.length - 1));
    $w('#test').text = allTeams[randomIndex];
}

The teams in “allTeams” are just examples. When I click the button, these are replaced with the user input from my text box element. But how do I get the textbox to input items to the list one-item-per-textbox-line?

Hope that helps clarify what I’m trying to do.