JSFiddle - React, Tailwind, and code Playground

JavaScript

function createConnection(port, host, connectListener) {
    var f = connectListener;
    if(arguments.length === 2 && typeof host === "function") {
        f = host;
        host = "localhost";
    }
    console.log("Host: " + host);
    console.log("Port: " + port);
    f();
}

createConnection(8080, function() { 
    console.log("Connecting listener...");
});