JSFiddle - React, Tailwind, and code Playground

by JonVisc

HTML

<body></body>

JavaScript

function foo(a, b) {
    b(function () {
        return a + a;
    });
}

// write a console.log that calls foo and outputs 8
//var test = foo(4, function (func) {console.log(func());});
var test = (function (func) {
                return func();
            }).call(foo);

(function(func) {
    return func();
}).call(foo);

console.log(foo(4, test));