Skip to content

Instantly share code, notes, and snippets.

@DrAzraelTod
Last active July 4, 2017 09:08
Show Gist options
  • Save DrAzraelTod/4a0debcff210717f3a58f1cc491a4d1d to your computer and use it in GitHub Desktop.
Save DrAzraelTod/4a0debcff210717f3a58f1cc491a4d1d to your computer and use it in GitHub Desktop.
Kleiner JS-Spaß mit arguments.callee.name
x = function(foo) { console.log(arguments.callee.name) };
x("test")
> x
y = function(func) { func("bar") }
y(x)
> x
z = x
z()
> x
x = undefined
z()
> x
y(function() {console.log(arguments.callee.name)})
> undefined
var y = function() {console.log(arguments.callee.name)}
y()
> y
a = y
delete(y)
y()
> Uncaught ReferenceError: y is not defined
a()
> y
b = function(foo) {
console.log(
arguments[0]()
)
};
b(function() { return arguments.callee.name })
> ""
var x = function(foo) {
if(foo === undefined) {
return eval(arguments.callee.name+"('bar');");
} else {
return foo;
}
};
x()
> "bar"
z = x;
z();
> "bar"
delete(x);
z()
> Uncaught ReferenceError: x is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment