In the process of developing a JavaScript application, I am tasked with creating a handler that can accept a function as a parameter:
Here is an example function:
function myFunction()
{
alert("hello world");
}
This is the handler implementation:
function handler(action)
{
action();
}
When calling the handler like this:
handler(myFunction);
It seems to work correctly on certain browsers, but fails to work on others. What could be causing this inconsistency?