Good afternoon, I'm new to the JavaScript world, and I have a question with a simple example,
function myFun(){
return arguments;
}
var myVar=myFun("a","b","c");
console.log(myVar);
for(m in myVar){
console.log(m);
}
According to the above snippet, why does the first call invoke an argument object with inherited properties from the main Function object, and the second only generates realistic arguments.
If we passed an argument to the object of the second function, why should it be passed only with realistic data, for example
function foo(something) {
console.log(something);
return this.a + something;
}
var obj = {
a: 2
};
var bar = function() {
return foo.apply( obj, arguments );
};
var b = bar( 3 );
as indicated in the console.log line (something), it will only generate realistic parameters only
source
share