I understand how to call a callback normally, but when I try to call a callback using the arguments array it doesn’t work. Here is code for how it is normally:
function someFunc(parameter1, callback){
alert(parameter1);
callback.call();
}
someFunc('Hello', function(){
alert('World!');
});
And the exact same format using the arguments array, which doesn’t work.
function someFunc(parameter1){
alert(parameter1);
arguments[arguments.length-1].call();
}
someFunc('Hello', function(){
alert('World!');
});
What is going on here?
Your code has no errors whatsoever and should work fine on its own. This example shows that it is working perfectly. — http://jsfiddle.net/FDT8N/