-
-
Save brycebaril/34f0c58a10981ac8fa3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function abc() { | |
return def(); | |
} | |
function def() { | |
return abc.arguments[0] * 2; | |
} | |
abc(50); // >> 100 | |
// so that's weird enough but: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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