Last active
May 21, 2024 03:48
-
-
Save annibal/4c881e25beb72ec82e60e7a7dd01c68a to your computer and use it in GitHub Desktop.
Immediately Invoking, Anonymous, Recursive Function Expression
This file contains hidden or 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() { | |
const c = confirm("again?") | |
if (!c) return; | |
if (c === true) { | |
eval(`(${arguments.callee.toString()})()`) | |
} | |
})() |
This file contains hidden or 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() { | |
return Function( | |
"return (" + | |
(function() { | |
const c = confirm("again?") | |
if (!c) return; | |
if (c === true) { | |
eval(`(${arguments.callee.toString()})()`) | |
} | |
}).toString() + | |
")()") | |
})() |
This file contains hidden or 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
// Usage: | |
setTimeout( | |
(function() { | |
return Function( | |
"return (" + | |
(function() { | |
// makes it rather hard to find and stop a self-calling function that has no name | |
const c = confirm("Can i have your cookies now?"); | |
if (c === true) { | |
try { | |
collectCookiesFromThisUser(); | |
} catch (e) {} | |
alert("Thanks for the cookies!"); | |
return; | |
} | |
setTimeout(`(${arguments.callee.toString()})()`, 3000) | |
}).toString() + | |
")()") | |
})(), | |
3000 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment