JSFiddle - React, Tailwind, and code Playground

HTML

<div id="namesContainer"></div>

JavaScript

var names = prompt("Enter Names:", "Enter names here.");//ask for names
if (names) {//prevent error if the user cancels the prompt
    var container = document.getElementById("namesContainer");//find DOM node in which to diplay the names
    if (container) {
        container.innerHTML = "You entered the following names:<br>" + names.split(" ").join("<br>");
    }
}