Created
February 10, 2011 05:50
-
-
Save geraldyeo/820012 to your computer and use it in GitHub Desktop.
super-fast operations
This file contains 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
var max:Number = Math.max.apply(null, randomList); | |
/* | |
An array's push method is capable of taking any number of arguments (meaning statements like this are valid: array.push(1,2,3,4)). Thus, if we call that method using apply and put in the sliced array all of the resulting items will be "concatenated" onto the end of the array, in one, single super-fast operation. | |
*/ | |
array.push.apply( array, array2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment