I am having a problem with arguments object in a nested function, seems like arguments.length is taken from parent function while arguments[0] is taken from nested function… anybody can explain why this is happening ?and show me the most effective way to pass parent foo’s arguments to bar?
$.fn.foo = function(color1, color2, time ){
return this.each(function bar(){
for(var i = 0;i < (arguments.length - 1);i++){
alert(arguments.length); //this is taken from foo function and returns 2
alert(arguments[i]); //this is taken from bar
}
});
};
Simple solution: Get a local reference to
arguments.