Q:

How to execute a JavaScript function having its name as a string in Edge

function test(arg) {
    console.log("hello! " + arg);
    return true;
}
    
window["test"]("I AM");

In this code snippet I execute a function by its name as a string. It works in most browsers except Microsoft Edge. How can I execute a function in Edge if I only know its name as a string? I don't want to use eval().

A:

If you define your function straight to the window object then you can call it just with the string. 
window.test=(args)=>{console.log("hello! " + arg)}
window["test"]("My first stack overflow answer")
will return  "hello! My first stack overflow answer"

