JSFiddle - React, Tailwind, and code Playground

JavaScript

var test = function(){
    return{
        value: "hi",
        func1: function(){
            func2();
        } // <-- no invocation here, make `func1` a method not `undefined`
    };
}();

function func2(){
    alert(test.value);
}

test.func1(); // "hi"