What exactly happens when a function is called this way? I did not expect this.arguments to contain call arguments!
this
keyword really refers to the test
function - what you call
ed with. You can argue that by registering this === test
.
So what is this arguments
property? A very deprecated one that is installed on the actual arguments
object during a function call (and subsequently deleted, which, apparently, is the reason that console.dir
did not commit it correctly). Do not use it and do not care about it :-)
function test() { console.assert(this === test); console.assert(this.arguments === arguments); console.log(Object.getOwnPropertyDescriptor(this, "arguments")); } test.call(test, 'my', 'arguments'); // result (in Opera): Object { configurable: false, enumerable: false, value: Arguments { 0: "my", 1: "arguments", callee: Function {…}, length: 2 }, writable: false }
Bergi source share