I want to be able to define a function (either regular or arrow) globally in the js window like this:
function myRegularFunction(){
console.log("hello from the regular function");
}
const myArrowFunction = () => {
console.log("hello from the arrow function");
}
and then be able to invoke it elsewhere like this:
window['myRegularFunction']();
window['myArrowFunction']();
When I define functions as stated above, I am then able to inovke the regular function, but the arrow funcion is not appearing in the js window, and thus I cannot invoke it. From the console, I get: window['myArrowFunction'] undefined
Can anyone help me with this issue?