I am trying to simply detect that current method has which parameters so i am calling arguments in chrome developer tools while i pause execution in that method. But arguments returns [] empty array. But if i try to put some parameters inside function so this time arguments and parameters get filled. There is no anything wrong about this ?
Example:
function(){
console.log(arguments);//value is []
}
function(a,b,c){
console.log(arguments);//value is not not empty array. It contains few parameters.
}
I don’t understand how can it be ?
Edit :
Now i check it and it works but let me tell you when it is not working.
I simply use debugger then open console and write arguments and enter. Result is [] but if i using arguments in function and i see that it is filled correctly. So why just referencing arguments in console product [] result ?
Sorry if this doesn’t answer your question… it’s a little hard to understand what your actual question is…
If you’re trying to find how many arguments a function expects, then you can use
.length:Source: http://es5.github.com/#x15.3.5.1
If you’re trying to find how many arguments a function received then you can use
arguments.length. Note that it has nothing to do with the number of expected arguments.