JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" id="checker" value="checkthefunc">
JavaScript
//the function I want to invoke by String
function CheckMe() {
return "haha";
}
//the function that will search for the function and invoke it
function InvokeChecking(func2check) {
var fn = func2check;
console.log(typeof fn);
if (typeof fn === 'function') {
return fn(); //invoke the function
}
}
//the event listener ( ´ ▽ ` )ノ
$("#checker").click(function() {
alert("event is working");
alert(InvokeChecking(CheckMe));
});