JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="foobar" value="foo"/>
JavaScript
function makeClosure(callback,val)
{
var newO = {};
newO.intVal = val || 'foobar';
newO.CB = callback;
return function(foo)
{
newO.CB(JSON.stringify(newO) + foo);
}
}
var someC = makeClosure((function(e)
{
return function(val)
{
e.value = val;
}
})(document.getElementById('foobar')));
setTimeout(function(){someC('done');},1000);