I faced this issue recently. I could pass the problem, but I didn't get the concept behind it. If you try the snippet, you see what's going on. Can someone explain it?
function func1() {
console.log('Func1 executed.');
};
const func2 = () => {
console.log('Func2 executed.');
};
const test = () => {
window['func1'](); //Working
window['func2'](); //Not working
};
button {
width: 200px;
padding: 20px;
font-size: large;
cursor: pointer;
border: 0;
background: linear-gradient(to top right, gray, silver);
color: white;
border-radius: 7px;
box-shadow: 0px 5px 7px silver;
text-shadow: 0px 2px 2px rgba(0,0,0,0.5);
}
<button onclick='test()'>Execute</button>