In this article I will explain you how to pass JavaScript function or method as parameter / argument to another JavaScript function or method.
I will explain the same with a small example that will allow you to understand better how it works.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
     <script type="text/javascript">
         function Main(val) {
             var message;
             if (val == 1) {
                 message = "You executed Func 1";
                 ExecuteFunction(Func1, message)
             }
             if (val == 2) {
                 message = "You executed Func 2";
                 ExecuteFunction(Func2, message)
             }
         }
               //Executes the Function that is passed as parameter
         function ExecuteFunction(functionObj, params) {
             functionObj(params);
         }
         function Func1(message) {
             alert("Func1: " + message);
         }
         function Func2(message) {
             alert("Func2: " + message);
         }
    </script>
</head>
<body>
    <input type = "button" onclick = "Main(1)" value = "Button1" />
    <input type = "button" onclick = "Main(2)" value = "Button2" />
</body>
</html>

Above you will notice that I have two buttons that call the same method Main(val) with different arguments.
Now this method based on the value of the argument calls ExecuteFunction function and passes the following to it.
1.     Object of the function to be executed.
2.     Parameter that needs to be passed to the function to be executed.
Finally the ExecuteFunction method makes a call to the function which was passed as parameter.
Need:
The first question that will arise in your mind why and when do we need to pass a function as parameter or argument to another function. There are many cases the best I would say are the methods that require callbacks.
Consider a simple jQuery AJAX call method that makes a AJAX call to the server and fetches the response.
function GetUser() {
    $.ajax({
        type: "POST",
        url: "/AJAXPage.aspx/GetUser",
        data: '{userid:23}',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            alert(response.d);
        }
    });
}

Now the only thing that will change in above JavaScript snippet is
1.     URL of the page or service.
2.     The data to be passed to the server.
3.     The callback Success method.
Thus we make the above function generic and easy to use in the following way.
function MakeAJAXCall(url, data, SuccessMethod) {
    $.ajax({
        type: "POST",
        url: "/AJAXPage.aspx/GetUser",
        data: '{userid:23}',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            SuccessMethod(response);
        }
    });
}

Now the GetUser() function will be
function GetUser() {
    MakeAJAXCall("/AJAXPage.aspx/GetUser", '{userid:23}', OnSuccess);
}
function OnSuccess(response) {
    alert(response.d);
}

Now you can see how we have reduced redundancy of code by passing the variable items as parameters.
You can download the attached sample HTML page for reference.