Created
August 6, 2010 20:15
-
-
Save cowboy/511930 to your computer and use it in GitHub Desktop.
Some hawt splice-on-splice action for JD
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
| // The basic premise, splicing data into an array used as a map of some sort | |
| // (assume that numbers 1-9 are placeholders for legitimate splice args) | |
| m = Array(100); | |
| s = 'splice'; | |
| m[s](1); | |
| m[s](2); | |
| m[s](3); // do this kind of thing many times | |
| // Before: | |
| m=Array(100); | |
| m[s='splice'](1);m[s](2);m[s](3);m[s](4);m[s](5);m[s](6);m[s](7);m[s](8);m[s](9) | |
| // After (becomes smaller at the 9th splice): | |
| m=Array(100); | |
| (function s(){m.splice.apply(m,arguments);return s})(1)(2)(3)(4)(5)(6)(7)(8)(9) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment