|
|
|
|
|
by dioltas
4503 days ago
|
|
Just tried to understand the last bit myself. So he's doing 0["constructor"] which gives the constructor of a number, Number.
Then he's 0["constructor"]["constructor"] gives the constructor of Number, which is like a function, so he gets Function. var y = (0)["constructor"]["constructor"];
y == Function; // true
Then he basically does this ($.$ == Function): Function(
Function(
"return \"alert('I love you');\""
)()
)();
The inner function just returns the string "alert('I love you');", which then becomes the body for the outer function.I don't know why they didn't make it: Function ("alert('I love you');")(); Maybe they needed more chars for the heart. That was a good little crash course in javascript Function constructors! |
|