JSFiddle - React, Tailwind, and code Playground
JavaScript
foo = function(options) {
let {func} = options;
let a = [];
function executer(v) {
func(v);
}
return {executer};
};
let funk = function(v) {
a.push(v);
}
let bar = new foo({
func: funk
});
bar.executer(1);
bar.executer(2);
bar.executer(3);