Skip to content

Instantly share code, notes, and snippets.

@brycebaril
Forked from chee/bizarguments.js
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brycebaril/34f0c58a10981ac8fa3a to your computer and use it in GitHub Desktop.
Save brycebaril/34f0c58a10981ac8fa3a to your computer and use it in GitHub Desktop.
function abc() {
return def();
}
function def() {
return abc.arguments[0] * 2;
}
abc(50); // >> 100
// so that's weird enough but:
function foo(arg) {
bar();
console.log(arg);
}
function bar() {
foo.arguments[0] = "lol";
}
foo("hello") // prints "hello"
// alright, so you can't edit the arguments up the stack
function foo(arg) {
bar();
// this line is the only thing that changes:
console.log(arg, arguments[0]);
}
function bar() {
foo.arguments[0] = "lol";
}
foo("hello") // prints "lol" "lol"
// wait what
// wait what twice
function foo(arg) {
bar();
arguments;
console.log(arg);
}
function bar() {
foo.arguments[0] = "lol";
}
foo("hello") // prints "lol"
// peeking at arguments updates `arg` value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment