-
-
Save robbenmu/f6b6b367f99b95d5f0a1 to your computer and use it in GitHub Desktop.
JavaScript: call invo-cursion?
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
// OOP | |
console.log( 'OHAI'.blink() ); | |
// Call invocation | |
console.log( String.prototype.blink.call('OHAI') ); | |
// $ always makes things look awesome. | |
var $ = Function.prototype.call; | |
// Very explicit call invocation | |
console.log( $.call(String.prototype.blink, 'OHAI') ); | |
// Very, very explicit call invocation, ie. call invo-cursion? | |
console.log( $.call($,$,$,$,$,$,$,$,$,$,$,$, String.prototype.blink, 'OHAI') ); | |
// ^^^^^^^^^^^^^^^^^^^^^^^ "bonus" calls | |
// You can have fun with apply invocation and _ too. | |
var _ = Function.prototype.apply; | |
// Very, very explicit apply invocation, ie. apply invo-cursion. | |
console.log( _.apply(_,[_,[_,[_,[_,[_,[_,[_, [ String.prototype.blink, ['OHAI'] ]]]]]]]]) ); | |
// ^^^^^^^^^^^^^^^^^^^^^^ "bonus" applies, and fun w/brackets ^^^^^^^^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment