JSFiddle - React, Tailwind, and code Playground

HTML

<div id="myDiv">
</div>

JavaScript

var greeting;
    var newCustomer;

    //Some code sets the variable newCustomer to true or false

    if( newCustomer ){
        greeting = function () {
            alert("Thanks for visiting the Badlands!\n" + 
            "We hope your stay is...better than most.");
        
        };
    } else {
        greeting = function () {
            alert("Welcome back to the Badlands!\n" + 
            "Guess they aren't so bad huh?");
        };
    }
    function closeTerminal( message ){ message();}

function divGreeting(){
    document.getElementById('myDiv').innerHTML = "Thanks for visiting the Badlands!\n" + 
            "We hope your stay is...better than most."
}

    closeTerminal( greeting );
    closeTerminal( divGreeting );