function greeting(name, str) {
alert(str + ", " + name);
}
function callAnotherFunction(method) {
method.apply(null, arguments); // arguments refer to ["John", "Good morning"]
alert(arguments.length); // arguments refer to method
}
callAnotherFunction(function() {greeting("John", "Good morning")});
The significant point in this example is arguments in callAnotherFunction(method). It means differently in the same function. In method.apply(null, arguments), it refers to the arguments that passed from method. And in alert(arguments.length), it refers to method itself, not its arguments.These example might not make sense to some people but it very useful when you want to pass arguments from method to method.
Hope this help.